Merge pull request #689 from AdrianLxM/smb-wear2
no wear vibrations on SMB (optional)
This commit is contained in:
commit
0fe287bb79
8 changed files with 22 additions and 4 deletions
|
@ -16,6 +16,10 @@ public class EventOverviewBolusProgress extends Event {
|
||||||
public EventOverviewBolusProgress() {
|
public EventOverviewBolusProgress() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSMB(){
|
||||||
|
return (t != null) && t.isSMB;
|
||||||
|
}
|
||||||
|
|
||||||
public static EventOverviewBolusProgress getInstance() {
|
public static EventOverviewBolusProgress getInstance() {
|
||||||
if(eventOverviewBolusProgress == null) {
|
if(eventOverviewBolusProgress == null) {
|
||||||
eventOverviewBolusProgress = new EventOverviewBolusProgress();
|
eventOverviewBolusProgress = new EventOverviewBolusProgress();
|
||||||
|
|
|
@ -134,6 +134,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
||||||
detailedBolusInfo.insulin = configBuilderPlugin.applyBolusConstraints(detailedBolusInfo.insulin);
|
detailedBolusInfo.insulin = configBuilderPlugin.applyBolusConstraints(detailedBolusInfo.insulin);
|
||||||
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
|
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
|
||||||
Treatment t = new Treatment();
|
Treatment t = new Treatment();
|
||||||
|
t.isSMB = detailedBolusInfo.isSMB;
|
||||||
boolean connectionOK = false;
|
boolean connectionOK = false;
|
||||||
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, detailedBolusInfo.carbTime, t);
|
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, detailedBolusInfo.carbTime, t);
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
|
|
|
@ -135,6 +135,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
|
||||||
detailedBolusInfo.insulin = configBuilderPlugin.applyBolusConstraints(detailedBolusInfo.insulin);
|
detailedBolusInfo.insulin = configBuilderPlugin.applyBolusConstraints(detailedBolusInfo.insulin);
|
||||||
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
|
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
|
||||||
Treatment t = new Treatment();
|
Treatment t = new Treatment();
|
||||||
|
t.isSMB = detailedBolusInfo.isSMB;
|
||||||
boolean connectionOK = false;
|
boolean connectionOK = false;
|
||||||
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, detailedBolusInfo.carbTime, t);
|
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, detailedBolusInfo.carbTime, t);
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
|
|
|
@ -477,6 +477,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
|
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
|
||||||
|
|
||||||
Treatment t = new Treatment();
|
Treatment t = new Treatment();
|
||||||
|
t.isSMB = detailedBolusInfo.isSMB;
|
||||||
boolean connectionOK = false;
|
boolean connectionOK = false;
|
||||||
if (detailedBolusInfo.insulin > 0 || carbs > 0)
|
if (detailedBolusInfo.insulin > 0 || carbs > 0)
|
||||||
connectionOK = danaRSService.bolus(detailedBolusInfo.insulin, (int) carbs, System.currentTimeMillis() + carbTime * 60 * 1000 + 30000, t); // +30s to make the record different
|
connectionOK = danaRSService.bolus(detailedBolusInfo.insulin, (int) carbs, System.currentTimeMillis() + carbTime * 60 * 1000 + 30000, t); // +30s to make the record different
|
||||||
|
|
|
@ -148,6 +148,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
||||||
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
|
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
|
||||||
|
|
||||||
Treatment t = new Treatment();
|
Treatment t = new Treatment();
|
||||||
|
t.isSMB = detailedBolusInfo.isSMB;
|
||||||
boolean connectionOK = false;
|
boolean connectionOK = false;
|
||||||
if (detailedBolusInfo.insulin > 0 || carbs > 0)
|
if (detailedBolusInfo.insulin > 0 || carbs > 0)
|
||||||
connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) carbs, System.currentTimeMillis() + carbTime * 60 * 1000 + 30000, t); // +30s to make the record different
|
connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) carbs, System.currentTimeMillis() + carbTime * 60 * 1000 + 30000, t); // +30s to make the record different
|
||||||
|
|
|
@ -197,10 +197,12 @@ public class WearPlugin implements PluginBase {
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventOverviewBolusProgress ev) {
|
public void onStatusEvent(final EventOverviewBolusProgress ev) {
|
||||||
Intent intent = new Intent(ctx, WatchUpdaterService.class).setAction(WatchUpdaterService.ACTION_SEND_BOLUSPROGRESS);
|
if(!ev.isSMB()||SP.getBoolean("wear_notifySMB", false)) {
|
||||||
intent.putExtra("progresspercent", ev.percent);
|
Intent intent = new Intent(ctx, WatchUpdaterService.class).setAction(WatchUpdaterService.ACTION_SEND_BOLUSPROGRESS);
|
||||||
intent.putExtra("progressstatus", ev.status);
|
intent.putExtra("progresspercent", ev.percent);
|
||||||
ctx.startService(intent);
|
intent.putExtra("progressstatus", ev.status);
|
||||||
|
ctx.startService(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|
|
@ -929,6 +929,8 @@
|
||||||
<string name="let_temp_basal_run">Let current temp basal run</string>
|
<string name="let_temp_basal_run">Let current temp basal run</string>
|
||||||
<string name="mute">Mute</string>
|
<string name="mute">Mute</string>
|
||||||
<string name="nav_historybrowser">History browser</string>
|
<string name="nav_historybrowser">History browser</string>
|
||||||
|
<string name="wear_notifysmb_title">Notify on SMB</string>
|
||||||
|
<string name="wear_notifysmb_summary">Show SMB on the watch like a standard bolus.</string>
|
||||||
<string name="key_ns_create_announcements_from_errors">ns_create_announcements_from_errors</string>
|
<string name="key_ns_create_announcements_from_errors">ns_create_announcements_from_errors</string>
|
||||||
<string name="ns_create_announcements_from_errors_title">Create announcements from errors</string>
|
<string name="ns_create_announcements_from_errors_title">Create announcements from errors</string>
|
||||||
<string name="ns_create_announcements_from_errors_summary">Create Nightscout announcement for error dialogs and local alerts (also viewable in Careportal under Treatments)</string>
|
<string name="ns_create_announcements_from_errors_summary">Create Nightscout announcement for error dialogs and local alerts (also viewable in Careportal under Treatments)</string>
|
||||||
|
|
|
@ -30,6 +30,12 @@
|
||||||
android:key="wear_showbgi"
|
android:key="wear_showbgi"
|
||||||
android:summary="@string/wear_showbgi_summary"
|
android:summary="@string/wear_showbgi_summary"
|
||||||
android:title="@string/wear_showbgi_title" />
|
android:title="@string/wear_showbgi_title" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="wear_notifySMB"
|
||||||
|
android:summary="@string/wear_notifysmb_summary"
|
||||||
|
android:title="@string/wear_notifysmb_title" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in a new issue