Extract modules ruffy-spi, ruffyscripter.
This commit is contained in:
parent
e5eba342ba
commit
e4901f292f
51 changed files with 241 additions and 113 deletions
|
@ -174,4 +174,5 @@ dependencies {
|
||||||
}
|
}
|
||||||
compile 'com.google.code.gson:gson:2.7'
|
compile 'com.google.code.gson:gson:2.7'
|
||||||
compile 'com.google.guava:guava:20.0'
|
compile 'com.google.guava:guava:20.0'
|
||||||
|
compile project(path: ':ruffyscripter')
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.PumpState;
|
import de.jotomo.ruffy.spi.PumpState;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateGUI;
|
import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateGUI;
|
||||||
|
|
|
@ -29,11 +29,11 @@ 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.EventOverviewBolusProgress;
|
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateGUI;
|
import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateGUI;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.RuffyCommandsV1Impl;
|
import de.jotomo.ruffyscripter.RuffyCommandsV1Impl;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.BolusProgressReporter;
|
import de.jotomo.ruffy.spi.BolusProgressReporter;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.PumpState;
|
import de.jotomo.ruffy.spi.PumpState;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.RuffyCommands;
|
import de.jotomo.ruffy.spi.RuffyCommands;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
definePumpCapabilities();
|
definePumpCapabilities();
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
startAlerter();
|
startAlerter();
|
||||||
ruffyScripter = RuffyCommandsV1Impl.getInstance();
|
ruffyScripter = RuffyCommandsV1Impl.getInstance(MainApp.instance());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void definePumpCapabilities() {
|
private void definePumpCapabilities() {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import android.support.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.PumpState;
|
import de.jotomo.ruffy.spi.PumpState;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
class ComboPump {
|
class ComboPump {
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
1
ruffy-spi/.gitignore
vendored
Normal file
1
ruffy-spi/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
31
ruffy-spi/build.gradle
Normal file
31
ruffy-spi/build.gradle
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 23
|
||||||
|
buildToolsVersion "26.0.2"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 21
|
||||||
|
targetSdkVersion 23
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||||
|
exclude group: 'com.android.support', module: 'support-annotations'
|
||||||
|
})
|
||||||
|
compile 'com.android.support:appcompat-v7:23.4.0'
|
||||||
|
testCompile 'junit:junit:4.12'
|
||||||
|
}
|
25
ruffy-spi/proguard-rules.pro
vendored
Normal file
25
ruffy-spi/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in /home/joe/opt/android/sdk/tools/proguard/proguard-android.txt
|
||||||
|
# You can edit the include path and order by changing the proguardFiles
|
||||||
|
# directive in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# Add any project specific keep options here:
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
10
ruffy-spi/src/main/AndroidManifest.xml
Normal file
10
ruffy-spi/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
|
||||||
|
package="de.jotomo.ruffy">
|
||||||
|
|
||||||
|
<!--<application android:allowBackup="true" android:label="ruffy-spi"-->
|
||||||
|
<!--android:supportsRtl="true">-->
|
||||||
|
|
||||||
|
<!--</application>-->
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi;
|
package de.jotomo.ruffy.spi;
|
||||||
|
|
||||||
public class BasalProfile {
|
public class BasalProfile {
|
||||||
public final int number;
|
public final int number;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi;
|
package de.jotomo.ruffy.spi;
|
||||||
|
|
||||||
public interface BolusProgressReporter {
|
public interface BolusProgressReporter {
|
||||||
enum State {
|
enum State {
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi;
|
package de.jotomo.ruffy.spi;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.PumpHistory;
|
import de.jotomo.ruffy.spi.history.PumpHistory;
|
||||||
|
|
||||||
public class CommandResult {
|
public class CommandResult {
|
||||||
/** The request made made to the pump, like setting a TBR. */
|
/** The request made made to the pump, like setting a TBR. */
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi;
|
package de.jotomo.ruffy.spi;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi;
|
package de.jotomo.ruffy.spi;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.PumpHistoryRequest;
|
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
||||||
|
|
||||||
public interface RuffyCommands {
|
public interface RuffyCommands {
|
||||||
CommandResult deliverBolus(double amount, BolusProgressReporter bolusProgressReporter);
|
CommandResult deliverBolus(double amount, BolusProgressReporter bolusProgressReporter);
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
public class Bolus extends HistoryRecord {
|
public class Bolus extends HistoryRecord {
|
||||||
public final double amount;
|
public final double amount;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
public class Error extends HistoryRecord {
|
public class Error extends HistoryRecord {
|
||||||
/** Code is an E for error or W for warning, followed by a single digit, e.g. W7 (TBR cancelled). */
|
/** Code is an E for error or W for warning, followed by a single digit, e.g. W7 (TBR cancelled). */
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
public abstract class HistoryRecord {
|
public abstract class HistoryRecord {
|
||||||
public final long timestamp;
|
public final long timestamp;
|
|
@ -1,15 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.lang.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.Bolus;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.Tbr;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.Tdd;
|
|
||||||
|
|
||||||
public class PumpHistory {
|
public class PumpHistory {
|
||||||
public final int reservoirLevel;
|
public final int reservoirLevel;
|
||||||
@NonNull
|
@NonNull
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
/** What data a 'read history' request should return. */
|
/** What data a 'read history' request should return. */
|
||||||
public class PumpHistoryRequest {
|
public class PumpHistoryRequest {
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
public class Tbr extends HistoryRecord {
|
public class Tbr extends HistoryRecord {
|
||||||
public final int duration;
|
public final int duration;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history;
|
package de.jotomo.ruffy.spi.history;
|
||||||
|
|
||||||
/** Total daily dosage; amount of insulin delivered over a full day. */
|
/** Total daily dosage; amount of insulin delivered over a full day. */
|
||||||
public class Tdd extends HistoryRecord {
|
public class Tdd extends HistoryRecord {
|
1
ruffyscripter/.gitignore
vendored
Normal file
1
ruffyscripter/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
34
ruffyscripter/build.gradle
Normal file
34
ruffyscripter/build.gradle
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 23
|
||||||
|
buildToolsVersion "26.0.2"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 21
|
||||||
|
targetSdkVersion 23
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||||
|
exclude group: 'com.android.support', module: 'support-annotations'
|
||||||
|
})
|
||||||
|
compile 'com.android.support:appcompat-v7:23.4.0'
|
||||||
|
testCompile 'junit:junit:4.12'
|
||||||
|
compile project(':ruffy-spi')
|
||||||
|
compile 'org.slf4j:slf4j-api:1.7.12'
|
||||||
|
compile 'com.google.guava:guava:20.0'
|
||||||
|
}
|
25
ruffyscripter/proguard-rules.pro
vendored
Normal file
25
ruffyscripter/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in /home/joe/opt/android/sdk/tools/proguard/proguard-android.txt
|
||||||
|
# You can edit the include path and order by changing the proguardFiles
|
||||||
|
# directive in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# Add any project specific keep options here:
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
10
ruffyscripter/src/main/AndroidManifest.xml
Normal file
10
ruffyscripter/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
|
||||||
|
package="de.jotomo.ruffyscripter">
|
||||||
|
|
||||||
|
<!--<application android:allowBackup="true" android:label="ruffyscripter"-->
|
||||||
|
<!--android:supportsRtl="true">-->
|
||||||
|
<!---->
|
||||||
|
<!--</application>-->
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -2,7 +2,6 @@
|
||||||
package org.monkey.d.ruffy.ruffy.driver;
|
package org.monkey.d.ruffy.ruffy.driver;
|
||||||
|
|
||||||
// Declare any non-default types here with import statements
|
// Declare any non-default types here with import statements
|
||||||
|
|
||||||
import org.monkey.d.ruffy.ruffy.driver.display.Menu;
|
import org.monkey.d.ruffy.ruffy.driver.display.Menu;
|
||||||
|
|
||||||
interface IRTHandler {
|
interface IRTHandler {
|
|
@ -1,20 +1,21 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy;
|
package de.jotomo.ruffyscripter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.RuffyScripter;
|
import de.jotomo.ruffy.spi.BasalProfile;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.BasalProfile;
|
import de.jotomo.ruffy.spi.BolusProgressReporter;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.BolusProgressReporter;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.RuffyCommands;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.PumpHistory;
|
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.RuffyCommands;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.PumpHistoryRequest;
|
|
||||||
|
|
||||||
public class RuffyCommandsV1Impl implements RuffyCommands {
|
public class RuffyCommandsV1Impl implements RuffyCommands {
|
||||||
private static RuffyCommands delegate;
|
private static RuffyCommands delegate;
|
||||||
|
|
||||||
public static RuffyCommands getInstance() {
|
public static RuffyCommands getInstance(Context context) {
|
||||||
if (delegate == null) delegate = new RuffyScripter();
|
if (delegate == null) delegate = new RuffyScripter(context);
|
||||||
return delegate;
|
return delegate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter;
|
package de.jotomo.ruffyscripter;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -24,27 +24,24 @@ import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import de.jotomo.ruffyscripter.commands.BolusCommand;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands.BolusCommand;
|
import de.jotomo.ruffyscripter.commands.CancelTbrCommand;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands.CancelTbrCommand;
|
import de.jotomo.ruffyscripter.commands.Command;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands.Command;
|
import de.jotomo.ruffyscripter.commands.CommandException;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands.CommandException;
|
import de.jotomo.ruffyscripter.commands.GetPumpStateCommand;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands.GetPumpStateCommand;
|
import de.jotomo.ruffyscripter.commands.ReadBasalProfileCommand;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands.ReadBasalProfileCommand;
|
import de.jotomo.ruffyscripter.commands.SetBasalProfileCommand;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands.ReadHistoryCommand;
|
import de.jotomo.ruffyscripter.commands.SetTbrCommand;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands.ReadReserverLevelCommand;
|
import de.jotomo.ruffy.spi.BasalProfile;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands.SetBasalProfileCommand;
|
import de.jotomo.ruffy.spi.BolusProgressReporter;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands.SetTbrCommand;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.BasalProfile;
|
import de.jotomo.ruffy.spi.history.Bolus;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.BolusProgressReporter;
|
import de.jotomo.ruffy.spi.history.PumpHistory;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.PumpState;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.Bolus;
|
import de.jotomo.ruffy.spi.RuffyCommands;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.PumpHistory;
|
import de.jotomo.ruffy.spi.history.PumpHistoryRequest;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.PumpState;
|
import de.jotomo.ruffy.spi.history.Tbr;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.RuffyCommands;
|
import de.jotomo.ruffy.spi.history.Tdd;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.PumpHistoryRequest;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.Tbr;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.Tdd;
|
|
||||||
|
|
||||||
// TODO regularly read "My data" history (boluses, TBR) to double check all commands ran successfully.
|
// TODO regularly read "My data" history (boluses, TBR) to double check all commands ran successfully.
|
||||||
// Automatically compare against AAPS db, or log all requests in the PumpInterface (maybe Milos
|
// Automatically compare against AAPS db, or log all requests in the PumpInterface (maybe Milos
|
||||||
|
@ -74,8 +71,7 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
|
|
||||||
private ServiceConnection mRuffyServiceConnection;
|
private ServiceConnection mRuffyServiceConnection;
|
||||||
|
|
||||||
public RuffyScripter() {
|
public RuffyScripter(Context context) {
|
||||||
Context context = MainApp.instance().getApplicationContext();
|
|
||||||
boolean boundSucceeded = false;
|
boolean boundSucceeded = false;
|
||||||
|
|
||||||
try {
|
try {
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.RuffyScripter;
|
import de.jotomo.ruffyscripter.RuffyScripter;
|
||||||
|
|
||||||
public abstract class BaseCommand implements Command {
|
public abstract class BaseCommand implements Command {
|
||||||
// RS will inject itself here
|
// RS will inject itself here
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.RuffyScripter;
|
import de.jotomo.ruffyscripter.RuffyScripter;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.BolusProgressReporter;
|
import de.jotomo.ruffy.spi.BolusProgressReporter;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
import static info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.BolusProgressReporter.State.*;
|
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.*;
|
||||||
|
|
||||||
public class BolusCommand extends BaseCommand {
|
public class BolusCommand extends BaseCommand {
|
||||||
private static final Logger log = LoggerFactory.getLogger(BolusCommand.class);
|
private static final Logger log = LoggerFactory.getLogger(BolusCommand.class);
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import org.monkey.d.ruffy.ruffy.driver.display.MenuType;
|
import org.monkey.d.ruffy.ruffy.driver.display.MenuType;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -7,9 +7,8 @@ import org.slf4j.LoggerFactory;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.PumpState;
|
import de.jotomo.ruffy.spi.PumpState;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
|
||||||
|
|
||||||
// TODO robustness: can a TBR run out, whilst we're trying to cancel it?
|
// TODO robustness: can a TBR run out, whilst we're trying to cancel it?
|
||||||
// Hm, we could just ignore TBRs that run out within the next 60s (0:01 or even 0:02
|
// Hm, we could just ignore TBRs that run out within the next 60s (0:01 or even 0:02
|
||||||
|
@ -28,14 +27,14 @@ public class CancelTbrCommand extends BaseCommand {
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU);
|
scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU);
|
||||||
PumpState pumpState = scripter.readPumpState();
|
PumpState pumpState = scripter.readPumpState();
|
||||||
if (!pumpState.tbrActive) {
|
if (!pumpState.tbrActive) {
|
||||||
log.debug("active temp basal 90s ago: " +
|
// log.debug("active temp basal 90s ago: " +
|
||||||
MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis() - 90 * 1000));
|
// MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis() - 90 * 1000));
|
||||||
log.debug("active temp basal 60s ago: " +
|
// log.debug("active temp basal 60s ago: " +
|
||||||
MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis() - 30 * 1000));
|
// MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis() - 30 * 1000));
|
||||||
log.debug("active temp basal 30s ago: " +
|
// log.debug("active temp basal 30s ago: " +
|
||||||
MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis() - 30 * 1000));
|
// MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis() - 30 * 1000));
|
||||||
log.debug("active temp basal now:: " +
|
// log.debug("active temp basal now:: " +
|
||||||
MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()));
|
// MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()));
|
||||||
// TODO keep checking logs to ensure this case only happens because CancelTbrCommand was called
|
// TODO keep checking logs to ensure this case only happens because CancelTbrCommand was called
|
||||||
// twice by AAPS
|
// twice by AAPS
|
||||||
log.warn("No TBR active to cancel");
|
log.warn("No TBR active to cancel");
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.RuffyScripter;
|
import de.jotomo.ruffyscripter.RuffyScripter;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for all commands to be executed by the pump.
|
* Interface for all commands to be executed by the pump.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
public class CommandException extends RuntimeException {
|
public class CommandException extends RuntimeException {
|
||||||
public boolean success = false;
|
public boolean success = false;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.RuffyScripter;
|
import de.jotomo.ruffyscripter.RuffyScripter;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
public class GetBasalRateProfileCommand extends BaseCommand {
|
public class GetBasalRateProfileCommand extends BaseCommand {
|
||||||
private static final Logger log = LoggerFactory.getLogger(GetBasalRateProfileCommand.class);
|
private static final Logger log = LoggerFactory.getLogger(GetBasalRateProfileCommand.class);
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import org.monkey.d.ruffy.ruffy.driver.display.MenuType;
|
import org.monkey.d.ruffy.ruffy.driver.display.MenuType;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
import static info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands.GetPumpStateCommand.Stepper.runStep;
|
import static de.jotomo.ruffyscripter.commands.GetPumpStateCommand.Stepper.runStep;
|
||||||
|
|
||||||
public class GetPumpStateCommand extends BaseCommand {
|
public class GetPumpStateCommand extends BaseCommand {
|
||||||
interface Step {
|
interface Step {
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.RuffyScripter;
|
import de.jotomo.ruffyscripter.RuffyScripter;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
public class ReadBasalProfileCommand implements Command {
|
public class ReadBasalProfileCommand implements Command {
|
||||||
private final int number;
|
private final int number;
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.history.PumpHistory;
|
import de.jotomo.ruffy.spi.history.PumpHistory;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.RuffyScripter;
|
import de.jotomo.ruffyscripter.RuffyScripter;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
public class ReadHistoryCommand implements Command {
|
public class ReadHistoryCommand implements Command {
|
||||||
public ReadHistoryCommand(PumpHistory knownHistory) {
|
public ReadHistoryCommand(PumpHistory knownHistory) {
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.RuffyScripter;
|
import de.jotomo.ruffyscripter.RuffyScripter;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
public class ReadReserverLevelCommand implements Command {
|
public class ReadReserverLevelCommand implements Command {
|
||||||
@Override
|
@Override
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.BasalProfile;
|
import de.jotomo.ruffy.spi.BasalProfile;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.RuffyScripter;
|
import de.jotomo.ruffyscripter.RuffyScripter;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
public class SetBasalProfileCommand implements Command {
|
public class SetBasalProfileCommand implements Command {
|
||||||
public SetBasalProfileCommand(BasalProfile basalProfile) {
|
public SetBasalProfileCommand(BasalProfile basalProfile) {
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
public class SetBasalRateProfileCommand extends BaseCommand {
|
public class SetBasalRateProfileCommand extends BaseCommand {
|
||||||
@Override
|
@Override
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCombo.ruffy.internal.scripter.commands;
|
package de.jotomo.ruffyscripter.commands;
|
||||||
|
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffy.spi.CommandResult;
|
import de.jotomo.ruffy.spi.CommandResult;
|
||||||
|
|
||||||
public class SetTbrCommand extends BaseCommand {
|
public class SetTbrCommand extends BaseCommand {
|
||||||
private static final Logger log = LoggerFactory.getLogger(SetTbrCommand.class);
|
private static final Logger log = LoggerFactory.getLogger(SetTbrCommand.class);
|
|
@ -1 +1 @@
|
||||||
include ':app', ':wear'
|
include ':app', ':wear', ':ruffyscripter', ':ruffy-spi'
|
||||||
|
|
Loading…
Reference in a new issue