dana drivers switching working
This commit is contained in:
parent
db2fd55f7c
commit
4b389c2cad
36 changed files with 636 additions and 399 deletions
|
@ -80,6 +80,10 @@
|
|||
android:name=".plugins.DanaR.Services.ExecutionService"
|
||||
android:enabled="true"
|
||||
android:exported="false" />
|
||||
<service
|
||||
android:name=".plugins.DanaRKorean.Services.ExecutionService"
|
||||
android:enabled="true"
|
||||
android:exported="false" />
|
||||
|
||||
<service android:name=".plugins.Wear.wearintegration.WatchUpdaterService" android:exported="true" >
|
||||
<intent-filter> <action android:name="com.google.android.gms.wearable.BIND_LISTENER" /> </intent-filter>
|
||||
|
|
|
@ -90,6 +90,9 @@ public class MainActivity extends AppCompatActivity {
|
|||
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
String lang = SP.getString("language", "en");
|
||||
LocaleHelper.setLocale(getApplicationContext(), lang);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
recreate();
|
||||
try { // activity may be destroyed
|
||||
setUpTabs(ev.isSwitchToLast());
|
||||
|
@ -97,6 +100,8 @@ public class MainActivity extends AppCompatActivity {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setUpTabs(boolean switchToLast) {
|
||||
TabPageAdapter pageAdapter = new TabPageAdapter(getSupportFragmentManager(), this);
|
||||
|
|
|
@ -17,6 +17,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
|||
import info.nightscout.androidaps.plugins.DanaR.BluetoothDevicePreference;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRFragment;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.utils.LocaleHelper;
|
||||
|
||||
public class PreferencesActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
@ -89,7 +90,8 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
addPreferencesFromResource(R.xml.pref_nightscout);
|
||||
if (Config.DANAR) {
|
||||
DanaRPlugin danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class);
|
||||
if (danaRPlugin.isEnabled(PluginBase.PUMP)) {
|
||||
DanaRKoreanPlugin danaRKoreanPlugin = (DanaRKoreanPlugin) MainApp.getSpecificPlugin(DanaRKoreanPlugin.class);
|
||||
if (danaRPlugin.isEnabled(PluginBase.PUMP) || danaRKoreanPlugin.isEnabled(PluginBase.PUMP)) {
|
||||
addPreferencesFromResource(R.xml.pref_danar);
|
||||
addPreferencesFromResource(R.xml.pref_danarprofile);
|
||||
}
|
||||
|
|
|
@ -585,6 +585,10 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
return sExecutionService != null && sExecutionService.isConnecting();
|
||||
}
|
||||
|
||||
public static void doDisconnect(String from) {
|
||||
if (sExecutionService != null) sExecutionService.disconnect(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getJSONStatus() {
|
||||
if (getDanaRPump().lastConnection.getTime() + 5 * 60 * 1000L < new Date().getTime()) {
|
||||
|
|
|
@ -22,6 +22,11 @@ public class DanaRPump {
|
|||
public static final int UNITS_MGDL = 0;
|
||||
public static final int UNITS_MMOL = 1;
|
||||
|
||||
public static final int DELIVERY_PRIME = 0x01;
|
||||
public static final int DELIVERY_STEP_BOLUS = 0x02;
|
||||
public static final int DELIVERY_BASAL = 0x04;
|
||||
public static final int DELIVERY_EXT_BOLUS = 0x08;
|
||||
|
||||
public static final String PROFILE_PREFIX = "DanaR-";
|
||||
|
||||
public Date lastConnection = new Date(0);
|
||||
|
@ -35,12 +40,21 @@ public class DanaRPump {
|
|||
public int password = -1;
|
||||
public Date pumpTime = new Date(0);
|
||||
|
||||
public static final int DOMESTIC_MODEL = 0x01;
|
||||
public static final int EXPORT_MODEL = 0x03;
|
||||
public int model;
|
||||
public int protocol;
|
||||
public int productCode;
|
||||
|
||||
|
||||
// Status
|
||||
public boolean pumpSuspended;
|
||||
public boolean calculatorEnabled;
|
||||
public double dailyTotalUnits;
|
||||
public int maxDailyTotalUnits;
|
||||
|
||||
public double bolusStep;
|
||||
|
||||
public double iob;
|
||||
|
||||
public double reservoirRemainingUnits;
|
||||
|
@ -58,6 +72,7 @@ public class DanaRPump {
|
|||
public int tempBasalTotalSec;
|
||||
public Date tempBasalStart;
|
||||
|
||||
public boolean isDualBolusInProgress;
|
||||
public boolean isExtendedInProgress;
|
||||
public int extendedBolusMinutes;
|
||||
public double extendedBolusAmount;
|
||||
|
|
|
@ -174,6 +174,11 @@ public class ExecutionService extends Service {
|
|||
return connectionInProgress;
|
||||
}
|
||||
|
||||
public void disconnect(String from) {
|
||||
if (mSerialIOThread != null)
|
||||
mSerialIOThread.disconnect(from);
|
||||
}
|
||||
|
||||
public void connect(String from) {
|
||||
if (danaRPump.password != -1 && danaRPump.password != SafeParse.stringToInt(SP.getString("danar_password", "-1"))) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.wrongpumppassword), R.raw.error);
|
||||
|
@ -270,11 +275,11 @@ public class ExecutionService extends Service {
|
|||
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended();
|
||||
|
||||
|
||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo()); // TODO: show it somewhere
|
||||
mSerialIOThread.sendMessage(tempStatusMsg); // do this before statusBasic because here is temp duration
|
||||
mSerialIOThread.sendMessage(exStatusMsg);
|
||||
mSerialIOThread.sendMessage(statusMsg);
|
||||
mSerialIOThread.sendMessage(statusBasicMsg);
|
||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo()); // TODO: show it somewhere
|
||||
|
||||
if (danaRPump.isNewPump) {
|
||||
mSerialIOThread.sendMessage(new MsgCheckValue());
|
||||
|
|
|
@ -4,6 +4,11 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
/**
|
||||
* Created by mike on 30.06.2016.
|
||||
|
@ -17,15 +22,22 @@ public class MsgCheckValue extends MessageBase {
|
|||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
int a = intFromBuff(bytes, 0, 1);
|
||||
int b = intFromBuff(bytes, 1, 1);
|
||||
if (a != 3 || b <= 0) {
|
||||
// another message will follow
|
||||
} else {
|
||||
DanaRPump pump = DanaRPlugin.getDanaRPump();
|
||||
|
||||
pump.model = intFromBuff(bytes, 0, 1);
|
||||
pump.protocol = intFromBuff(bytes, 1, 1);
|
||||
pump.productCode = intFromBuff(bytes, 2, 1);
|
||||
if (pump.model != DanaRPump.EXPORT_MODEL) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.wrongpumpdriverselected), R.raw.error);
|
||||
((DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class)).doDisconnect("Wrong Model");
|
||||
log.debug("Wrong model selected");
|
||||
}
|
||||
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Model: " + String.format("%02X ", pump.model));
|
||||
log.debug("Protocol: " + String.format("%02X ", pump.protocol));
|
||||
log.debug("Product Code: " + String.format("%02X ", pump.productCode));
|
||||
}
|
||||
if (Config.logDanaMessageDetail)
|
||||
log.debug("Response: " + String.format("%02X ", a) + String.format("%02X ", b));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@ package info.nightscout.androidaps.plugins.DanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
|
||||
|
||||
public class MsgInitConnStatusBasic extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(MsgInitConnStatusBasic.class);
|
||||
|
||||
|
@ -12,25 +16,51 @@ public class MsgInitConnStatusBasic extends MessageBase {
|
|||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
int a = intFromBuff(bytes, 0, 1);
|
||||
int b = intFromBuff(bytes, 1, 1);
|
||||
int c = intFromBuff(bytes, 2, 1);
|
||||
int d = intFromBuff(bytes, 3, 1);
|
||||
int e = intFromBuff(bytes, 4, 1);
|
||||
int f = intFromBuff(bytes, 5, 1);
|
||||
int g = intFromBuff(bytes, 6, 1);
|
||||
int h = intFromBuff(bytes, 7, 1);
|
||||
int i = intFromBuff(bytes, 8, 1);
|
||||
int j = intFromBuff(bytes, 9, 1);
|
||||
int k = intFromBuff(bytes, 10, 1);
|
||||
int l = intFromBuff(bytes, 11, 1);
|
||||
int m = intFromBuff(bytes, 12, 1);
|
||||
int n = intFromBuff(bytes, 13, 1);
|
||||
int o;
|
||||
if (bytes.length - 10 < 21) {
|
||||
return;
|
||||
}
|
||||
DanaRPump pump = DanaRPlugin.getDanaRPump();
|
||||
pump.pumpSuspended = intFromBuff(bytes, 0, 1) == 1;
|
||||
pump.calculatorEnabled = intFromBuff(bytes, 1, 1) == 1;
|
||||
pump.dailyTotalUnits = intFromBuff(bytes, 2, 3) / 750d;
|
||||
pump.maxDailyTotalUnits = intFromBuff(bytes, 5, 2) / 100;
|
||||
pump.reservoirRemainingUnits = intFromBuff(bytes, 7, 3) / 750d;
|
||||
pump.bolusBlocked = intFromBuff(bytes, 10, 1) == 1;
|
||||
pump.currentBasal = intFromBuff(bytes, 11, 2) / 100d;
|
||||
pump.tempBasalPercent = intFromBuff(bytes, 13, 1);
|
||||
pump.isExtendedInProgress = intFromBuff(bytes, 14, 1) == 1;
|
||||
pump.isTempBasalInProgress = intFromBuff(bytes, 15, 1) == 1;
|
||||
int statusBasalUDOption = intFromBuff(bytes, 16, 1);
|
||||
pump.isDualBolusInProgress = intFromBuff(bytes, 17, 1) == 1;
|
||||
double extendedBolusRate = intFromBuff(bytes, 18, 2) / 100d;
|
||||
pump.batteryRemaining = intFromBuff(bytes, 20, 1);
|
||||
try {
|
||||
o = intFromBuff(bytes, 21, 1);
|
||||
} catch (Exception ex) {
|
||||
o = 0;
|
||||
int bolusConfig = intFromBuff(bytes, 21, 1);
|
||||
boolean deliveryPrime = (bolusConfig & DanaRPump.DELIVERY_PRIME) != 0;
|
||||
boolean deliveryStepBolus = (bolusConfig & DanaRPump.DELIVERY_STEP_BOLUS) != 0;
|
||||
boolean deliveryBasal = (bolusConfig & DanaRPump.DELIVERY_BASAL) != 0;
|
||||
boolean deliveryExtBolus = (bolusConfig & DanaRPump.DELIVERY_EXT_BOLUS) != 0;
|
||||
log.debug("Delivery prime: " + deliveryPrime);
|
||||
log.debug("Delivery step bolus: " + deliveryStepBolus);
|
||||
log.debug("Delivery basal: " + deliveryBasal);
|
||||
log.debug("Delivery ext bolus: " + deliveryExtBolus);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Pump suspended: " + pump.pumpSuspended);
|
||||
log.debug("Calculator enabled: " + pump.calculatorEnabled);
|
||||
log.debug("Daily total units: " + pump.dailyTotalUnits);
|
||||
log.debug("Max daily total units: " + pump.maxDailyTotalUnits);
|
||||
log.debug("Reservoir remaining units: " + pump.reservoirRemainingUnits);
|
||||
log.debug("Bolus blocked: " + pump.bolusBlocked);
|
||||
log.debug("Current basal: " + pump.currentBasal);
|
||||
log.debug("Current temp basal percent: " + pump.tempBasalPercent);
|
||||
log.debug("Is extended bolus running: " + pump.isExtendedInProgress);
|
||||
log.debug("statusBasalUDOption: " + statusBasalUDOption);
|
||||
log.debug("Is dual bolus running: " + pump.isDualBolusInProgress);
|
||||
log.debug("Extended bolus rate: " + extendedBolusRate);
|
||||
log.debug("Battery remaining: " + pump.batteryRemaining);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@ package info.nightscout.androidaps.plugins.DanaR.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
|
||||
|
||||
/**
|
||||
* Created by mike on 28.05.2016.
|
||||
*/
|
||||
|
@ -15,10 +19,27 @@ public class MsgInitConnStatusBolus extends MessageBase {
|
|||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
int a1 = intFromBuff(bytes, 0, 1);
|
||||
int a2 = intFromBuff(bytes, 1, 1);
|
||||
int c = intFromBuff(bytes, 8, 2);
|
||||
int d = c / 100;
|
||||
int e = intFromBuff(bytes, 10, 2);
|
||||
if (bytes.length - 10 > 12) {
|
||||
return;
|
||||
}
|
||||
DanaRPump pump = DanaRPlugin.getDanaRPump();
|
||||
int bolusConfig = intFromBuff(bytes, 0, 1);
|
||||
boolean deliveryPrime = (bolusConfig & DanaRPump.DELIVERY_PRIME) != 0;
|
||||
boolean deliveryStepBolus = (bolusConfig & DanaRPump.DELIVERY_STEP_BOLUS) != 0;
|
||||
boolean deliveryBasal = (bolusConfig & DanaRPump.DELIVERY_BASAL) != 0;
|
||||
boolean deliveryExtBolus = (bolusConfig & DanaRPump.DELIVERY_EXT_BOLUS) != 0;
|
||||
|
||||
pump.bolusStep = intFromBuff(bytes, 1, 1) / 100d;
|
||||
pump.maxBolus = intFromBuff(bytes, 2, 2) / 100d;
|
||||
//int bolusRate = intFromBuff(bytes, 4, 8);
|
||||
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Delivery prime: " + deliveryPrime);
|
||||
log.debug("Delivery step bolus: " + deliveryStepBolus);
|
||||
log.debug("Delivery basal: " + deliveryBasal);
|
||||
log.debug("Delivery ext bolus: " + deliveryExtBolus);
|
||||
log.debug("Bolus increment: " + pump.bolusStep);
|
||||
log.debug("Bolus max: " + pump.maxBolus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,15 +18,15 @@ public class MsgInitConnStatusOption extends MessageBase {
|
|||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
int a = intFromBuff(bytes, 0, 1);
|
||||
int b = intFromBuff(bytes, 1, 1);
|
||||
int c = intFromBuff(bytes, 2, 1);
|
||||
int d = intFromBuff(bytes, 3, 1);
|
||||
int e = intFromBuff(bytes, 4, 1);
|
||||
int f = intFromBuff(bytes, 5, 1);
|
||||
int g = intFromBuff(bytes, 6, 1);
|
||||
int h = intFromBuff(bytes, 7, 1);
|
||||
int i = intFromBuff(bytes, 8, 1);
|
||||
int status1224Clock = intFromBuff(bytes, 0, 1);
|
||||
int isStatusButtonScroll = intFromBuff(bytes, 1, 1);
|
||||
int soundVibration = intFromBuff(bytes, 2, 1);
|
||||
int glucoseUnit = intFromBuff(bytes, 3, 1);
|
||||
int lcdTimeout = intFromBuff(bytes, 4, 1);
|
||||
int backlightgTimeout = intFromBuff(bytes, 5, 1);
|
||||
int languageOption = intFromBuff(bytes, 6, 1);
|
||||
int lowReservoirAlarmBoundary = intFromBuff(bytes, 7, 1);
|
||||
//int none = intFromBuff(bytes, 8, 1);
|
||||
if (bytes.length >= 21) {
|
||||
DanaRPlugin.getDanaRPump().password = intFromBuff(bytes, 9, 2) ^ 0x3463;
|
||||
if (Config.logDanaMessageDetail)
|
||||
|
|
|
@ -6,6 +6,14 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class MsgInitConnStatusTime extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(MsgInitConnStatusTime.class);
|
||||
|
@ -16,9 +24,25 @@ public class MsgInitConnStatusTime extends MessageBase {
|
|||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
Date time = dateTimeSecFromBuff(bytes, 0);
|
||||
if (bytes.length - 10 > 7) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(),MainApp.sResources.getString(R.string.wrongpumpdriverselected), R.raw.error);
|
||||
((DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class)).doDisconnect("Wrong Model");
|
||||
log.debug("Wrong model selected. Switching to Korean DanaR");
|
||||
((DanaRKoreanPlugin)MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setFragmentEnabled(PluginBase.PUMP, true);
|
||||
((DanaRKoreanPlugin)MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setFragmentVisible(PluginBase.PUMP, true);
|
||||
((DanaRPlugin)MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentEnabled(PluginBase.PUMP, false);
|
||||
((DanaRPlugin)MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentVisible(PluginBase.PUMP, false);
|
||||
MainApp.getConfigBuilder().storeSettings();
|
||||
MainApp.bus().post(new EventRefreshGui(false));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.logDanaMessageDetail)
|
||||
Date time = dateTimeSecFromBuff(bytes, 0);
|
||||
int versionCode = intFromBuff(bytes, 6, 1);
|
||||
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Pump time: " + time);
|
||||
log.debug("Version code: " + versionCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Date;
|
|||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.07.2016.
|
||||
|
@ -19,17 +20,18 @@ public class MsgSettingShippingInfo extends MessageBase {
|
|||
}
|
||||
|
||||
public void handleMessage(byte[] bytes) {
|
||||
DanaRPlugin.getDanaRPump().serialNumber = stringFromBuff(bytes, 0, 10);
|
||||
DanaRPlugin.getDanaRPump().shippingDate = dateFromBuff(bytes, 10);
|
||||
DanaRPlugin.getDanaRPump().shippingCountry = asciiStringFromBuff(bytes, 13, 3);
|
||||
if (DanaRPlugin.getDanaRPump().shippingDate.getTime() > new Date(116, 4, 1).getTime()) {
|
||||
DanaRPlugin.getDanaRPump().isNewPump = true;
|
||||
DanaRPump pump = DanaRPlugin.getDanaRPump();
|
||||
pump.serialNumber = stringFromBuff(bytes, 0, 10);
|
||||
pump.shippingDate = dateFromBuff(bytes, 10);
|
||||
pump.shippingCountry = asciiStringFromBuff(bytes, 13, 3);
|
||||
if (pump.shippingDate.getTime() > new Date(116, 4, 1).getTime()) {
|
||||
pump.isNewPump = true;
|
||||
} else
|
||||
DanaRPlugin.getDanaRPump().isNewPump = false;
|
||||
pump.isNewPump = false;
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Serial number: " + DanaRPlugin.getDanaRPump().serialNumber);
|
||||
log.debug("Shipping date: " + DanaRPlugin.getDanaRPump().shippingDate);
|
||||
log.debug("Shipping country: " + DanaRPlugin.getDanaRPump().shippingCountry);
|
||||
log.debug("Serial number: " + pump.serialNumber);
|
||||
log.debug("Shipping date: " + pump.shippingDate);
|
||||
log.debug("Shipping country: " + pump.shippingCountry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
|
||||
|
||||
|
||||
public class MsgStatusBasic extends MessageBase {
|
||||
|
@ -15,41 +16,31 @@ public class MsgStatusBasic extends MessageBase {
|
|||
}
|
||||
|
||||
public void handleMessage(byte[] bytes) {
|
||||
boolean pumpSuspended = intFromBuff(bytes, 0, 1) == 1;
|
||||
boolean calculatorEnabled = intFromBuff(bytes, 1, 1) == 1;
|
||||
double dailyTotalUnits = intFromBuff(bytes, 2, 3) / 750d;
|
||||
int maxDailyTotalUnits = intFromBuff(bytes, 5, 2) / 100;
|
||||
double reservoirRemainingUnits = intFromBuff(bytes, 7, 3) / 750d;
|
||||
boolean bolusBlocked = intFromBuff(bytes, 10, 1) == 1;
|
||||
double currentBasal = intFromBuff(bytes, 11, 2) / 100d;
|
||||
int tempBasalPercent = intFromBuff(bytes, 13, 1);
|
||||
boolean isExtendedInProgress = intFromBuff(bytes, 14, 1) == 1;
|
||||
boolean isTempBasalInProgress = intFromBuff(bytes, 15, 1) == 1;
|
||||
int batteryRemaining = intFromBuff(bytes, 20, 1);
|
||||
DanaRPump pump = DanaRPlugin.getDanaRPump();
|
||||
|
||||
DanaRPlugin.getDanaRPump().pumpSuspended = pumpSuspended;
|
||||
DanaRPlugin.getDanaRPump().calculatorEnabled = calculatorEnabled;
|
||||
DanaRPlugin.getDanaRPump().dailyTotalUnits = dailyTotalUnits;
|
||||
DanaRPlugin.getDanaRPump().maxDailyTotalUnits = maxDailyTotalUnits;
|
||||
DanaRPlugin.getDanaRPump().reservoirRemainingUnits = reservoirRemainingUnits;
|
||||
DanaRPlugin.getDanaRPump().bolusBlocked = bolusBlocked;
|
||||
DanaRPlugin.getDanaRPump().currentBasal = currentBasal;
|
||||
DanaRPlugin.getDanaRPump().tempBasalPercent = tempBasalPercent;
|
||||
DanaRPlugin.getDanaRPump().isExtendedInProgress = isExtendedInProgress;
|
||||
DanaRPlugin.getDanaRPump().isTempBasalInProgress = isTempBasalInProgress;
|
||||
DanaRPlugin.getDanaRPump().batteryRemaining = batteryRemaining;
|
||||
pump.pumpSuspended = intFromBuff(bytes, 0, 1) == 1;
|
||||
pump.calculatorEnabled = intFromBuff(bytes, 1, 1) == 1;
|
||||
pump.dailyTotalUnits = intFromBuff(bytes, 2, 3) / 750d;
|
||||
pump.maxDailyTotalUnits = intFromBuff(bytes, 5, 2) / 100;
|
||||
pump.reservoirRemainingUnits = intFromBuff(bytes, 7, 3) / 750d;
|
||||
pump.bolusBlocked = intFromBuff(bytes, 10, 1) == 1;
|
||||
pump.currentBasal = intFromBuff(bytes, 11, 2) / 100d;
|
||||
pump.tempBasalPercent = intFromBuff(bytes, 13, 1);
|
||||
pump.isExtendedInProgress = intFromBuff(bytes, 14, 1) == 1;
|
||||
pump.isTempBasalInProgress = intFromBuff(bytes, 15, 1) == 1;
|
||||
pump.batteryRemaining = intFromBuff(bytes, 20, 1);
|
||||
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Pump suspended: " + pumpSuspended);
|
||||
log.debug("Calculator enabled: " + calculatorEnabled);
|
||||
log.debug("Daily total units: " + dailyTotalUnits);
|
||||
log.debug("Max daily total units: " + maxDailyTotalUnits);
|
||||
log.debug("Reservoir remaining units: " + reservoirRemainingUnits);
|
||||
log.debug("Bolus blocked: " + bolusBlocked);
|
||||
log.debug("Current basal: " + currentBasal);
|
||||
log.debug("Current temp basal percent: " + tempBasalPercent);
|
||||
log.debug("Is extended bolus running: " + isExtendedInProgress);
|
||||
log.debug("Is temp basal running: " + isTempBasalInProgress);
|
||||
log.debug("Pump suspended: " + pump.pumpSuspended);
|
||||
log.debug("Calculator enabled: " + pump.calculatorEnabled);
|
||||
log.debug("Daily total units: " + pump.dailyTotalUnits);
|
||||
log.debug("Max daily total units: " + pump.maxDailyTotalUnits);
|
||||
log.debug("Reservoir remaining units: " + pump.reservoirRemainingUnits);
|
||||
log.debug("Bolus blocked: " + pump.bolusBlocked);
|
||||
log.debug("Current basal: " + pump.currentBasal);
|
||||
log.debug("Current temp basal percent: " + pump.tempBasalPercent);
|
||||
log.debug("Is extended bolus running: " + pump.isExtendedInProgress);
|
||||
log.debug("Is temp basal running: " + pump.isTempBasalInProgress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,13 +200,13 @@ public class DanaRKoreanFragment extends Fragment implements FragmentBase {
|
|||
lastConnectionView.setText(formatTime.format(DanaRKoreanPlugin.getDanaRPump().lastConnection) + " (" + agoMin + " " + MainApp.sResources.getString(R.string.minago) + ")");
|
||||
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
||||
}
|
||||
if (DanaRKoreanPlugin.getDanaRPump().lastBolusTime.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - DanaRKoreanPlugin.getDanaRPump().lastBolusTime.getTime();
|
||||
double agoHours = agoMsec / 60d / 60d / 1000d;
|
||||
if (agoHours < 6) // max 6h back
|
||||
lastBolusView.setText(formatTime.format(DanaRKoreanPlugin.getDanaRPump().lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(danaRKoreanPlugin.getDanaRPump().lastBolusAmount) + " U");
|
||||
else lastBolusView.setText("");
|
||||
}
|
||||
// if (DanaRKoreanPlugin.getDanaRPump().lastBolusTime.getTime() != 0) {
|
||||
// Long agoMsec = new Date().getTime() - DanaRKoreanPlugin.getDanaRPump().lastBolusTime.getTime();
|
||||
// double agoHours = agoMsec / 60d / 60d / 1000d;
|
||||
// if (agoHours < 6) // max 6h back
|
||||
// lastBolusView.setText(formatTime.format(DanaRKoreanPlugin.getDanaRPump().lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(danaRKoreanPlugin.getDanaRPump().lastBolusAmount) + " U");
|
||||
// else lastBolusView.setText("");
|
||||
// }
|
||||
|
||||
dailyUnitsView.setText(DecimalFormatter.to0Decimal(DanaRKoreanPlugin.getDanaRPump().dailyTotalUnits) + " / " + DanaRKoreanPlugin.getDanaRPump().maxDailyTotalUnits + " U");
|
||||
SetWarnColor.setColor(dailyUnitsView, DanaRKoreanPlugin.getDanaRPump().dailyTotalUnits, DanaRKoreanPlugin.getDanaRPump().maxDailyTotalUnits * 0.75d, DanaRKoreanPlugin.getDanaRPump().maxDailyTotalUnits * 0.9d);
|
||||
|
|
|
@ -584,6 +584,10 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
return sExecutionService != null && sExecutionService.isConnecting();
|
||||
}
|
||||
|
||||
public static void doDisconnect(String from) {
|
||||
if (sExecutionService != null) sExecutionService.disconnect(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getJSONStatus() {
|
||||
if (getDanaRPump().lastConnection.getTime() + 5 * 60 * 1000L < new Date().getTime()) {
|
||||
|
@ -599,8 +603,8 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection));
|
||||
extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
|
||||
extended.put("PumpIOB", getDanaRPump().iob);
|
||||
extended.put("LastBolus", getDanaRPump().lastBolusTime.toLocaleString());
|
||||
extended.put("LastBolusAmount", getDanaRPump().lastBolusAmount);
|
||||
// extended.put("LastBolus", getDanaRPump().lastBolusTime.toLocaleString());
|
||||
// extended.put("LastBolusAmount", getDanaRPump().lastBolusAmount);
|
||||
if (isTempBasalInProgress()) {
|
||||
extended.put("TempBasalAbsoluteRate", getTempBasalAbsoluteRate());
|
||||
extended.put("TempBasalStart", getTempBasal().timeStart.toLocaleString());
|
||||
|
@ -718,9 +722,9 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||
ret += "LastConn: " + agoMin + " minago\n";
|
||||
}
|
||||
if (getDanaRPump().lastBolusTime.getTime() != 0) {
|
||||
ret += "LastBolus: " + DecimalFormatter.to2Decimal(getDanaRPump().lastBolusAmount) + "U @" + android.text.format.DateFormat.format("HH:mm", getDanaRPump().lastBolusTime) + "\n";
|
||||
}
|
||||
// if (getDanaRPump().lastBolusTime.getTime() != 0) {
|
||||
// ret += "LastBolus: " + DecimalFormatter.to2Decimal(getDanaRPump().lastBolusAmount) + "U @" + android.text.format.DateFormat.format("HH:mm", getDanaRPump().lastBolusTime) + "\n";
|
||||
// }
|
||||
if (isRealTempBasalInProgress()) {
|
||||
ret += "Temp: " + getRealTempBasal().toString() + "\n";
|
||||
}
|
||||
|
|
|
@ -22,6 +22,11 @@ public class DanaRKoreanPump {
|
|||
public static final int UNITS_MGDL = 0;
|
||||
public static final int UNITS_MMOL = 1;
|
||||
|
||||
public static final int DELIVERY_PRIME = 0x01;
|
||||
public static final int DELIVERY_STEP_BOLUS = 0x02;
|
||||
public static final int DELIVERY_BASAL = 0x04;
|
||||
public static final int DELIVERY_EXT_BOLUS = 0x08;
|
||||
|
||||
public static final String PROFILE_PREFIX = "DanaR-";
|
||||
|
||||
public Date lastConnection = new Date(0);
|
||||
|
@ -35,21 +40,23 @@ public class DanaRKoreanPump {
|
|||
public int password = -1;
|
||||
public Date pumpTime = new Date(0);
|
||||
|
||||
public static final int DOMESTIC_MODEL = 0x01;
|
||||
public static final int EXPORT_MODEL = 0x03;
|
||||
public int model;
|
||||
public int protocol;
|
||||
public int productCode;
|
||||
|
||||
// Status
|
||||
public boolean pumpSuspended;
|
||||
public boolean calculatorEnabled;
|
||||
public double dailyTotalUnits;
|
||||
public int maxDailyTotalUnits;
|
||||
|
||||
public double bolusStep;
|
||||
|
||||
public double iob;
|
||||
|
||||
public double reservoirRemainingUnits;
|
||||
public int batteryRemaining;
|
||||
|
||||
public boolean bolusBlocked;
|
||||
public Date lastBolusTime = new Date(0);
|
||||
public double lastBolusAmount;
|
||||
|
||||
public double currentBasal;
|
||||
|
||||
public boolean isTempBasalInProgress;
|
||||
|
|
|
@ -42,10 +42,10 @@ import info.nightscout.androidaps.R;
|
|||
import info.nightscout.androidaps.db.DanaRHistoryRecord;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaR.History.DanaRNSHistorySync;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.RecordTypes;
|
||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRSyncStatus;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.Services.ExecutionService;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.comm.RecordTypes;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
|
|
@ -0,0 +1,224 @@
|
|||
package info.nightscout.androidaps.plugins.DanaRKorean;
|
||||
|
||||
import android.bluetooth.BluetoothSocket;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.comm.MessageHashTable;
|
||||
import info.nightscout.utils.CRC;
|
||||
|
||||
/**
|
||||
* Created by mike on 17.07.2016.
|
||||
*/
|
||||
public class SerialIOThread extends Thread {
|
||||
private static Logger log = LoggerFactory.getLogger(SerialIOThread.class);
|
||||
|
||||
private InputStream mInputStream = null;
|
||||
private OutputStream mOutputStream = null;
|
||||
private BluetoothSocket mRfCommSocket;
|
||||
|
||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||
private static ScheduledFuture<?> scheduledDisconnection = null;
|
||||
|
||||
private boolean mKeepRunning = true;
|
||||
private byte[] mReadBuff = new byte[0];
|
||||
|
||||
MessageBase processedMessage;
|
||||
|
||||
public SerialIOThread(BluetoothSocket rfcommSocket) {
|
||||
super(SerialIOThread.class.toString());
|
||||
|
||||
mRfCommSocket = rfcommSocket;
|
||||
try {
|
||||
mOutputStream = mRfCommSocket.getOutputStream();
|
||||
mInputStream = mRfCommSocket.getInputStream();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void run() {
|
||||
try {
|
||||
while (mKeepRunning) {
|
||||
int availableBytes = mInputStream.available();
|
||||
// Ask for 1024 byte (or more if available)
|
||||
byte[] newData = new byte[Math.max(1024, availableBytes)];
|
||||
int gotBytes = mInputStream.read(newData);
|
||||
// When we are here there is some new data available
|
||||
appendToBuffer(newData, gotBytes);
|
||||
|
||||
// process all messages we already got
|
||||
while (mReadBuff.length > 3) { // 3rd byte is packet size. continue only if we an determine packet size
|
||||
byte[] extractedBuff = cutMessageFromBuffer();
|
||||
if (extractedBuff == null) break; // message is not complete in buffer (wrong packet calls disconnection)
|
||||
|
||||
int command = (extractedBuff[5] & 0xFF) | ((extractedBuff[4] << 8) & 0xFF00);
|
||||
|
||||
MessageBase message;
|
||||
if (processedMessage != null && processedMessage.getCommand() == command) {
|
||||
message = processedMessage;
|
||||
} else {
|
||||
// get it from hash table
|
||||
message = MessageHashTable.findMessage(command);
|
||||
}
|
||||
|
||||
if (Config.logDanaMessageDetail)
|
||||
log.debug("<<<<< " + message.getMessageName() + " " + message.toHexString(extractedBuff));
|
||||
|
||||
// process the message content
|
||||
message.received = true;
|
||||
message.handleMessage(extractedBuff);
|
||||
synchronized (message) {
|
||||
message.notify();
|
||||
}
|
||||
scheduleDisconnection();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (Config.logDanaSerialEngine && e.getMessage().indexOf("bt socket closed") < 0)
|
||||
log.error("Thread exception: ", e);
|
||||
mKeepRunning = false;
|
||||
}
|
||||
disconnect("EndOfLoop");
|
||||
}
|
||||
|
||||
void appendToBuffer(byte[] newData, int gotBytes) {
|
||||
// add newData to mReadBuff
|
||||
byte[] newReadBuff = new byte[mReadBuff.length + gotBytes];
|
||||
System.arraycopy(mReadBuff, 0, newReadBuff, 0, mReadBuff.length);
|
||||
System.arraycopy(newData, 0, newReadBuff, mReadBuff.length, gotBytes);
|
||||
mReadBuff = newReadBuff;
|
||||
}
|
||||
|
||||
byte[] cutMessageFromBuffer() {
|
||||
if (mReadBuff[0] == (byte) 0x7E && mReadBuff[1] == (byte) 0x7E) {
|
||||
int length = (mReadBuff[2] & 0xFF) + 7;
|
||||
// Check if we have enough data
|
||||
if (mReadBuff.length < length) {
|
||||
return null;
|
||||
}
|
||||
if (mReadBuff[length - 2] != (byte) 0x2E || mReadBuff[length - 1] != (byte) 0x2E) {
|
||||
log.error("wrong packet lenght=" + length + " data " + MessageBase.toHexString(mReadBuff));
|
||||
disconnect("wrong packet");
|
||||
return null;
|
||||
}
|
||||
|
||||
short crc = CRC.getCrc16(mReadBuff, 3, length - 7);
|
||||
byte crcByte0 = (byte) (crc >> 8 & 0xFF);
|
||||
byte crcByte1 = (byte) (crc & 0xFF);
|
||||
|
||||
byte crcByte0received = mReadBuff[length - 4];
|
||||
byte crcByte1received = mReadBuff[length - 3];
|
||||
|
||||
if (crcByte0 != crcByte0received || crcByte1 != crcByte1received) {
|
||||
log.error("CRC Error" + String.format("%02x ", crcByte0) + String.format("%02x ", crcByte1) + String.format("%02x ", crcByte0received) + String.format("%02x ", crcByte1received));
|
||||
disconnect("crc error");
|
||||
return null;
|
||||
}
|
||||
// Packet is verified here. extract data
|
||||
byte[] extractedBuff = new byte[length];
|
||||
System.arraycopy(mReadBuff, 0, extractedBuff, 0, length);
|
||||
// remove extracted data from read buffer
|
||||
byte[] unprocessedData = new byte[mReadBuff.length - length];
|
||||
System.arraycopy(mReadBuff, length, unprocessedData, 0, unprocessedData.length);
|
||||
mReadBuff = unprocessedData;
|
||||
return extractedBuff;
|
||||
} else {
|
||||
log.error("Wrong beginning of packet len=" + mReadBuff.length + " " + MessageBase.toHexString(mReadBuff));
|
||||
disconnect("Wrong beginning of packet");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void sendMessage(MessageBase message) {
|
||||
if (!mRfCommSocket.isConnected()) {
|
||||
log.error("Socket not connected on sendMessage");
|
||||
return;
|
||||
}
|
||||
processedMessage = message;
|
||||
|
||||
byte[] messageBytes = message.getRawMessageBytes();
|
||||
if (Config.logDanaSerialEngine)
|
||||
log.debug(">>>>> " + message.getMessageName() + " " + message.toHexString(messageBytes));
|
||||
|
||||
try {
|
||||
mOutputStream.write(messageBytes);
|
||||
} catch (Exception e) {
|
||||
log.error("sendMessage write exception: ", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
synchronized (message) {
|
||||
try {
|
||||
message.wait(5000);
|
||||
} catch (InterruptedException e) {
|
||||
log.error("sendMessage InterruptedException", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
if (!message.received) {
|
||||
log.warn("Reply not received " + message.getMessageName());
|
||||
}
|
||||
scheduleDisconnection();
|
||||
}
|
||||
|
||||
public void scheduleDisconnection() {
|
||||
class DisconnectRunnable implements Runnable {
|
||||
public void run() {
|
||||
disconnect("scheduleDisconnection");
|
||||
scheduledDisconnection = null;
|
||||
}
|
||||
}
|
||||
// prepare task for execution in 5 sec
|
||||
// cancel waiting task to prevent sending multiple disconnections
|
||||
if (scheduledDisconnection != null)
|
||||
scheduledDisconnection.cancel(false);
|
||||
Runnable task = new DisconnectRunnable();
|
||||
final int sec = 5;
|
||||
scheduledDisconnection = worker.schedule(task, sec, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void disconnect(String reason) {
|
||||
mKeepRunning = false;
|
||||
try {
|
||||
mInputStream.close();
|
||||
} catch (Exception e) {
|
||||
if (Config.logDanaSerialEngine) log.debug(e.getMessage());
|
||||
}
|
||||
try {
|
||||
mOutputStream.close();
|
||||
} catch (Exception e) {
|
||||
if (Config.logDanaSerialEngine) log.debug(e.getMessage());
|
||||
}
|
||||
try {
|
||||
mRfCommSocket.close();
|
||||
} catch (Exception e) {
|
||||
if (Config.logDanaSerialEngine) log.debug(e.getMessage());
|
||||
}
|
||||
try {
|
||||
System.runFinalization();
|
||||
} catch (Exception e) {
|
||||
if (Config.logDanaSerialEngine) log.debug(e.getMessage());
|
||||
}
|
||||
if (Config.logDanaSerialEngine) log.debug("Disconnected: " + reason);
|
||||
}
|
||||
|
||||
}
|
|
@ -31,13 +31,14 @@ import info.nightscout.androidaps.R;
|
|||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.events.EventAppExit;
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||
import info.nightscout.androidaps.plugins.DanaR.SerialIOThread;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.RecordTypes;
|
||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRBolusStart;
|
||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRNewStatus;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPump;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.SerialIOThread;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.comm.*;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
|
@ -139,6 +140,11 @@ public class ExecutionService extends Service {
|
|||
return connectionInProgress;
|
||||
}
|
||||
|
||||
public void disconnect(String from) {
|
||||
if (mSerialIOThread != null)
|
||||
mSerialIOThread.disconnect(from);
|
||||
}
|
||||
|
||||
public void connect(String from) {
|
||||
if (danaRKoreanPump.password != -1 && danaRKoreanPump.password != SafeParse.stringToInt(SP.getString("danar_password", "-1"))) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.wrongpumppassword), R.raw.error);
|
||||
|
@ -229,25 +235,23 @@ public class ExecutionService extends Service {
|
|||
|
||||
private boolean getPumpStatus() {
|
||||
try {
|
||||
MsgStatus statusMsg = new MsgStatus();
|
||||
//MsgStatus statusMsg = new MsgStatus();
|
||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
||||
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended();
|
||||
|
||||
|
||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo()); // TODO: show it somewhere
|
||||
mSerialIOThread.sendMessage(tempStatusMsg); // do this before statusBasic because here is temp duration
|
||||
mSerialIOThread.sendMessage(exStatusMsg);
|
||||
mSerialIOThread.sendMessage(statusMsg);
|
||||
//mSerialIOThread.sendMessage(statusMsg);
|
||||
mSerialIOThread.sendMessage(statusBasicMsg);
|
||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo()); // TODO: show it somewhere
|
||||
|
||||
if (danaRKoreanPump.isNewPump) {
|
||||
mSerialIOThread.sendMessage(new MsgCheckValue());
|
||||
}
|
||||
|
||||
if (!statusMsg.received) {
|
||||
mSerialIOThread.sendMessage(statusMsg);
|
||||
}
|
||||
// if (!statusMsg.received) {
|
||||
// mSerialIOThread.sendMessage(statusMsg);
|
||||
// }
|
||||
if (!statusBasicMsg.received) {
|
||||
mSerialIOThread.sendMessage(statusBasicMsg);
|
||||
}
|
||||
|
@ -261,7 +265,7 @@ public class ExecutionService extends Service {
|
|||
}
|
||||
|
||||
// Check we have really current status of pump
|
||||
if (!statusMsg.received || !statusBasicMsg.received || !tempStatusMsg.received || !exStatusMsg.received) {
|
||||
if (/*!statusMsg.received || */!statusBasicMsg.received || !tempStatusMsg.received || !exStatusMsg.received) {
|
||||
waitMsec(10 * 1000);
|
||||
log.debug("getPumpStatus failed");
|
||||
return false;
|
||||
|
|
|
@ -1,163 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.DanaRKorean.comm;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Created by mike on 28.05.2016.
|
||||
*/
|
||||
public class MessageOriginalNames {
|
||||
private static Logger log = LoggerFactory.getLogger(MessageOriginalNames.class);
|
||||
|
||||
public static HashMap<Integer,String> messageNames;
|
||||
|
||||
static {
|
||||
messageNames = new HashMap<Integer,String>();
|
||||
|
||||
messageNames.put(0x3001, "CMD_CONNECT");
|
||||
messageNames.put(0x3002, "CMD_DISCONNECT");
|
||||
|
||||
messageNames.put(0x3101, "CMD_HISTORY_MEAL_INS");
|
||||
messageNames.put(0x3102, "CMD_HISTORY_DAY_INS");
|
||||
messageNames.put(0x3103, "CMD_HISTORY_AIR_SUB");
|
||||
messageNames.put(0x3104, "CMD_HISTORY_GLUCOSE");
|
||||
messageNames.put(0x3105, "CMD_HISTORY_ALARM");
|
||||
messageNames.put(0x3106, "CMD_HISTORY_ERROR");
|
||||
messageNames.put(0x3107, "CMD_HISTORY_CARBOHY");
|
||||
messageNames.put(0x3108, "CMD_HISTORY_REFILL");
|
||||
messageNames.put(0x3109, "CMD_HISTORY_SUSPEND");
|
||||
messageNames.put(0x310a, "CMD_HISTORY_BASAL_HOUR");
|
||||
messageNames.put(0x310b, "CMD_HISTORY_TB");
|
||||
messageNames.put(0x31f1, "CMD_HISTORY_STOP");
|
||||
messageNames.put(0x31f2, "CMD_HISTORY_LAST_T_R");
|
||||
messageNames.put(0x31f3, "CMD_HISTORY_LAST_T_S");
|
||||
|
||||
messageNames.put(0x0501, "CMD_HISPAGE_MEAL_INS");
|
||||
messageNames.put(0x0502, "CMD_HISPAGE_DAY_INS");
|
||||
messageNames.put(0x0503, "CMD_HISPAGE_AIR_SUB");
|
||||
messageNames.put(0x0504, "CMD_HISPAGE_GLUCOSE");
|
||||
messageNames.put(0x0505, "CMD_HISPAGE_ALARM");
|
||||
messageNames.put(0x0506, "CMD_HISPAGE_ERROR");
|
||||
messageNames.put(0x0507, "CMD_HISPAGE_CARBOHY");
|
||||
messageNames.put(0x0508, "CMD_HISPAGE_REFILL");
|
||||
messageNames.put(0x050a, "CMD_HISPAGE_DAILTY_PRE_DATA");
|
||||
messageNames.put(0x050b, "CMD_HISPAGE_BOLUS_AVG");
|
||||
messageNames.put(0x050c, "CMD_HISPAGE_BASAL_RECORD");
|
||||
messageNames.put(0x050d, "CMD_HISPAGE_TB");
|
||||
|
||||
messageNames.put(0x3201, "CMD_SETTING_V_MEAL_INS_I");
|
||||
messageNames.put(0x3202, "CMD_SETTING_V_BASAL_INS_I");
|
||||
messageNames.put(0x3203, "CMD_SETTING_V_MEAL_SETTING_I");
|
||||
messageNames.put(0x3204, "CMD_SETTING_V_CCC_I");
|
||||
messageNames.put(0x3205, "CMD_SETTING_V_MAX_VALUE_I");
|
||||
messageNames.put(0x3206, "CMD_SETTING_V_BASAL_PROFILE_ALL");
|
||||
messageNames.put(0x3207, "CMD_SETTING_V_SHIPPING_I");
|
||||
messageNames.put(0x3208, "CMD_SETTING_V_CLOGGIN_SENS_I");
|
||||
messageNames.put(0x3209, "CMD_SETTING_V_GLUCOSEandEASY");
|
||||
messageNames.put(0x320a, "CMD_SETTING_V_TIME_I");
|
||||
messageNames.put(0x320b, "CMD_SETTING_V_USER_OPTIONS");
|
||||
messageNames.put(0x320c, "CMD_SETTING_V_PROFILE_NUMBER");
|
||||
messageNames.put(0x320d, "CMD_SETTING_V_CIR_CF_VALUE");
|
||||
|
||||
messageNames.put(0x3301, "CMD_SETTING_MEAL_INS_S");
|
||||
messageNames.put(0x3302, "CMD_SETTING_Based_INS_S");
|
||||
messageNames.put(0x3303, "CMD_SETTING_MEAL_SETTING_S");
|
||||
messageNames.put(0x3304, "CMD_SETTING_CCC_S");
|
||||
messageNames.put(0x3305, "CMD_SETTING_MAX_VALUE_S");
|
||||
messageNames.put(0x3306, "CMD_SETTING_BASAL_PROFILE_S");
|
||||
messageNames.put(0x3307, "CMD_SETTING_SHIPPING_S");
|
||||
messageNames.put(0x3308, "CMD_SETTING_CLOGGIN_SENS_S");
|
||||
messageNames.put(0x3309, "CMD_SETTING_GLUCOSEandEASY_S");
|
||||
messageNames.put(0x330a, "CMD_SETTING_TIME_S");
|
||||
messageNames.put(0x330b, "CMD_SETTING_USER_OPTIONS_S");
|
||||
messageNames.put(0x330c, "CMD_SETTING_PROFILE_NUMBER_S");
|
||||
messageNames.put(0x330d, "CMD_SETTING_CIR_CF_VALUE_S");
|
||||
|
||||
messageNames.put(0x0101, "CMD_MEALINS_STOP");
|
||||
messageNames.put(0x0102, "CMD_MEALINS_START_DATA");
|
||||
messageNames.put(0x0103, "CMD_MEALINS_START_NODATA");
|
||||
messageNames.put(0x0104, "CMD_MEALINS_START_DATA_SPEED");
|
||||
messageNames.put(0x0105, "CMD_MEALINS_START_NODATA_SPEED");
|
||||
|
||||
messageNames.put(0x0201, "CMD_PUMP_ACT_INS_VALUE");
|
||||
messageNames.put(0x0202, "CMD_PUMP_THIS_REMAINDER_MEAL_INS");
|
||||
messageNames.put(0x0203, "CMD_PUMP_BASE_SET");
|
||||
messageNames.put(0x0204, "CMD_PUMP_CALCULATION_SETTING");
|
||||
messageNames.put(0x0205, "CMD_PUMP_EXERCISE_MODE");
|
||||
messageNames.put(0x0206, "CMD_PUMP_MEAL_INS_I");
|
||||
|
||||
messageNames.put(0x0207, "CMD_PUMP_EXPANS_INS_I");
|
||||
messageNames.put(0x0208, "CMD_PUMP_EXPANS_INS_RQ");
|
||||
|
||||
messageNames.put(0x0209, "CMD_PUMP_DUAL_INS_RQ");
|
||||
messageNames.put(0x020a, "CMD_PUMP_INITVIEW_I");
|
||||
messageNames.put(0x020b, "CMD_PUMP_STATUS");
|
||||
messageNames.put(0x020c, "CMD_PUMP_CAR_N_CIR");
|
||||
|
||||
messageNames.put(0x0301, "CMD_PUMPINIT_TIME_INFO");
|
||||
messageNames.put(0x0302, "CMD_PUMPINIT_BOLUS_INFO");
|
||||
messageNames.put(0x0303, "CMD_PUMPINIT_INIT_INFO");
|
||||
messageNames.put(0x0304, "CMD_PUMPINIT_OPTION");
|
||||
|
||||
messageNames.put(0x0401, "CMD_PUMPSET_EXERCISE_S");
|
||||
messageNames.put(0x0402, "CMD_PUMPSET_HIS_S");
|
||||
messageNames.put(0x0403, "CMD_PUMPSET_EXERCISE_STOP");
|
||||
|
||||
messageNames.put(0x0404, "CMD_PUMPSET_PAUSE");
|
||||
messageNames.put(0x0405, "CMD_PUMPSET_PAUSE_STOP");
|
||||
|
||||
messageNames.put(0x0406, "CMD_PUMPSET_EXPANS_INS_STOP");
|
||||
messageNames.put(0x0407, "CMD_PUMPSET_EXPANS_INS_S");
|
||||
|
||||
messageNames.put(0x0408, "CMD_PUMPSET_DUAL_S");
|
||||
messageNames.put(0x0409, "CMD_PUMPSET_EASY_OFF");
|
||||
|
||||
|
||||
messageNames.put(0x0601, "CMD_PUMPOWAY_SYSTEM_STATUS");
|
||||
messageNames.put(0x0602, "CMD_PUMPOWAY_GLUCOSE_ALARM");
|
||||
messageNames.put(0x0603, "CMD_PUMPOWAY_LOW_INSULIN_ALARM");
|
||||
messageNames.put(0x0610, "CMD_PUMP_ALARM_TIEOUT");
|
||||
|
||||
messageNames.put(0x0701, "CMD_MSGRECEP_TAKE_SUGAR");
|
||||
messageNames.put(0x0702, "CMD_MSGRECEP_GO_TO_DOCTOR");
|
||||
messageNames.put(0x0703, "CMD_MSGRECEP_CALL_TO_CAREGIVER");
|
||||
messageNames.put(0x0704, "CMD_MSGRECEP_CHECK_GLUCOSE_AGAIN");
|
||||
messageNames.put(0x0705, "CMD_MSGRECEP_CALL_TO_HOME");
|
||||
messageNames.put(0x0706, "CMD_MSGRECEP_DO_DELIVER");
|
||||
|
||||
messageNames.put(0x0801, "CMD_MSGSEND_YES_I_DO");
|
||||
messageNames.put(0x0802, "CMD_MSGSEND_NO_I_CANNOT");
|
||||
messageNames.put(0x0803, "CMD_MSGSEND_CALL_TO_ME_MOM");
|
||||
messageNames.put(0x0804, "CMD_MSGSEND_DO_NOT_INFUSE");
|
||||
|
||||
messageNames.put(0x0901, "CMD_FILL_REFILL_COUNT");
|
||||
messageNames.put(0x0902, "CMD_FILL_PRIME_CHECK");
|
||||
messageNames.put(0x0903, "CMD_FILL_PRIME_END");
|
||||
messageNames.put(0x0904, "CMD_FILL_PRIME_STOP");
|
||||
messageNames.put(0x0905, "CMD_FILL_PRIME_PAUSE");
|
||||
messageNames.put(0x0906, "CMD_FILL_PRIME_RATE");
|
||||
|
||||
messageNames.put(0x41f2, "CMD_HISTORY_ALL");
|
||||
messageNames.put(0x42f2, "CMD_HISTORY_NEW");
|
||||
|
||||
messageNames.put(0x41f1, "CMD_HISTORY_ALL_DONE");
|
||||
messageNames.put(0x42f1, "CMD_HISTORY_NEW_DONE");
|
||||
|
||||
messageNames.put(0xF0F1, "CMD_PUMP_CHECK_VALUE");
|
||||
messageNames.put(0xF0F2, "CMD_PUMP_TIMECHANGE_CHECK");
|
||||
messageNames.put(0xF0F3, "CMD_PUMP_TIMECHANGE_CLEAR");
|
||||
messageNames.put(0x43F2, "CMD_HISTORY_DATEOVER_ALL");
|
||||
messageNames.put(0x4300, "CMD_HISTORY_DATEOVER_DONE");
|
||||
}
|
||||
|
||||
public static String getName(Integer command) {
|
||||
if (messageNames.containsKey(command))
|
||||
return messageNames.get(command);
|
||||
else {
|
||||
log.debug("Unknown command: " + String.format("%04X", command));
|
||||
return "UNKNOWN_COMMAND";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,12 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPump;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
/**
|
||||
* Created by mike on 30.06.2016.
|
||||
|
@ -18,15 +23,22 @@ public class MsgCheckValue extends MessageBase {
|
|||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
int a = intFromBuff(bytes, 0, 1);
|
||||
int b = intFromBuff(bytes, 1, 1);
|
||||
if (a != 3 || b <= 0) {
|
||||
// another message will follow
|
||||
} else {
|
||||
DanaRKoreanPump pump = DanaRKoreanPlugin.getDanaRPump();
|
||||
|
||||
pump.model = intFromBuff(bytes, 0, 1);
|
||||
pump.protocol = intFromBuff(bytes, 1, 1);
|
||||
pump.productCode = intFromBuff(bytes, 2, 1);
|
||||
if (pump.model != DanaRKoreanPump.DOMESTIC_MODEL) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(),MainApp.sResources.getString(R.string.wrongpumpdriverselected), R.raw.error);
|
||||
((DanaRKoreanPlugin)MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).doDisconnect("Wrong Model");
|
||||
log.debug("Wrong model selected");
|
||||
}
|
||||
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Model: " + String.format("%02X ", pump.model));
|
||||
log.debug("Protocol: " + String.format("%02X ", pump.protocol));
|
||||
log.debug("Product Code: " + String.format("%02X ", pump.productCode));
|
||||
}
|
||||
if (Config.logDanaMessageDetail)
|
||||
log.debug("Response: " + String.format("%02X ", a) + String.format("%02X ", b));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Date;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.db.DanaRHistoryRecord;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.RecordTypes;
|
||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRSyncStatus;
|
||||
|
||||
public class MsgHistoryAll extends MessageBase {
|
||||
|
|
|
@ -3,7 +3,10 @@ package info.nightscout.androidaps.plugins.DanaRKorean.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPump;
|
||||
|
||||
public class MsgInitConnStatusBasic extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(MsgInitConnStatusBasic.class);
|
||||
|
@ -14,25 +17,21 @@ public class MsgInitConnStatusBasic extends MessageBase {
|
|||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
int a = intFromBuff(bytes, 0, 1);
|
||||
int b = intFromBuff(bytes, 1, 1);
|
||||
int c = intFromBuff(bytes, 2, 1);
|
||||
int d = intFromBuff(bytes, 3, 1);
|
||||
int e = intFromBuff(bytes, 4, 1);
|
||||
int f = intFromBuff(bytes, 5, 1);
|
||||
int g = intFromBuff(bytes, 6, 1);
|
||||
int h = intFromBuff(bytes, 7, 1);
|
||||
int i = intFromBuff(bytes, 8, 1);
|
||||
int j = intFromBuff(bytes, 9, 1);
|
||||
int k = intFromBuff(bytes, 10, 1);
|
||||
int l = intFromBuff(bytes, 11, 1);
|
||||
int m = intFromBuff(bytes, 12, 1);
|
||||
int n = intFromBuff(bytes, 13, 1);
|
||||
int o;
|
||||
try {
|
||||
o = intFromBuff(bytes, 21, 1);
|
||||
} catch (Exception ex) {
|
||||
o = 0;
|
||||
if (bytes.length - 10 > 6) {
|
||||
return;
|
||||
}
|
||||
DanaRKoreanPump pump = DanaRKoreanPlugin.getDanaRPump();
|
||||
int isStatusSuspendOn = intFromBuff(bytes, 0, 1);
|
||||
int isUtilityEnable = intFromBuff(bytes, 1, 1);
|
||||
int isEasyUIEnable = intFromBuff(bytes, 2, 1);
|
||||
int easyUIMode = intFromBuff(bytes, 3, 1);
|
||||
pump.password = intFromBuff(bytes, 4, 2) ^ 0x3463;
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("isStatusSuspendOn: " + isStatusSuspendOn);
|
||||
log.debug("isUtilityEnable: " + isUtilityEnable);
|
||||
log.debug("isEasyUIEnable: " + isEasyUIEnable);
|
||||
log.debug("easyUIMode: " + easyUIMode);
|
||||
log.debug("Pump password: " + pump.password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@ package info.nightscout.androidaps.plugins.DanaRKorean.comm;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPump;
|
||||
|
||||
/**
|
||||
* Created by mike on 28.05.2016.
|
||||
|
@ -17,10 +20,29 @@ public class MsgInitConnStatusBolus extends MessageBase {
|
|||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
int a1 = intFromBuff(bytes, 0, 1);
|
||||
int a2 = intFromBuff(bytes, 1, 1);
|
||||
int c = intFromBuff(bytes, 8, 2);
|
||||
int d = c / 100;
|
||||
int e = intFromBuff(bytes, 10, 2);
|
||||
if (bytes.length - 10 < 13) {
|
||||
return;
|
||||
}
|
||||
DanaRKoreanPump pump = DanaRKoreanPlugin.getDanaRPump();
|
||||
int bolusConfig = intFromBuff(bytes, 0, 1);
|
||||
boolean deliveryPrime = (bolusConfig & DanaRKoreanPump.DELIVERY_PRIME) != 0;
|
||||
boolean deliveryStepBolus = (bolusConfig & DanaRKoreanPump.DELIVERY_STEP_BOLUS) != 0;
|
||||
boolean deliveryBasal = (bolusConfig & DanaRKoreanPump.DELIVERY_BASAL) != 0;
|
||||
boolean deliveryExtBolus = (bolusConfig & DanaRKoreanPump.DELIVERY_EXT_BOLUS) != 0;
|
||||
|
||||
pump.bolusStep = intFromBuff(bytes, 1, 1) / 100d;
|
||||
pump.maxBolus = intFromBuff(bytes, 2, 2) / 100d;
|
||||
//int bolusRate = intFromBuff(bytes, 4, 8);
|
||||
int deliveryStatus = intFromBuff(bytes, 12, 1);
|
||||
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Delivery prime: " + deliveryPrime);
|
||||
log.debug("Delivery step bolus: " + deliveryStepBolus);
|
||||
log.debug("Delivery basal: " + deliveryBasal);
|
||||
log.debug("Delivery ext bolus: " + deliveryExtBolus);
|
||||
log.debug("Bolus increment: " + pump.bolusStep);
|
||||
log.debug("Bolus max: " + pump.maxBolus);
|
||||
log.debug("Delivery status: " + deliveryStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,14 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class MsgInitConnStatusTime extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(MsgInitConnStatusTime.class);
|
||||
|
@ -17,9 +24,32 @@ public class MsgInitConnStatusTime extends MessageBase {
|
|||
|
||||
@Override
|
||||
public void handleMessage(byte[] bytes) {
|
||||
Date time = dateTimeSecFromBuff(bytes, 0);
|
||||
|
||||
if (Config.logDanaMessageDetail)
|
||||
if (bytes.length - 10 < 10) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(),MainApp.sResources.getString(R.string.wrongpumpdriverselected), R.raw.error);
|
||||
((DanaRKoreanPlugin)MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).doDisconnect("Wrong Model");
|
||||
log.debug("Wrong model selected. Switching to export DanaR");
|
||||
((DanaRKoreanPlugin)MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setFragmentEnabled(PluginBase.PUMP, false);
|
||||
((DanaRKoreanPlugin)MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setFragmentVisible(PluginBase.PUMP, false);
|
||||
((DanaRPlugin)MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentEnabled(PluginBase.PUMP, true);
|
||||
((DanaRPlugin)MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentVisible(PluginBase.PUMP, true);
|
||||
MainApp.getConfigBuilder().storeSettings();
|
||||
MainApp.bus().post(new EventRefreshGui(false));
|
||||
return;
|
||||
}
|
||||
|
||||
Date time = dateTimeSecFromBuff(bytes, 0);
|
||||
int versionCode1 = intFromBuff(bytes, 6, 1);
|
||||
int versionCode2 = intFromBuff(bytes, 7, 1);
|
||||
int versionCode3 = intFromBuff(bytes, 8, 1);
|
||||
int versionCode4 = intFromBuff(bytes, 9, 1);
|
||||
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Pump time: " + time);
|
||||
log.debug("Version code1: " + versionCode1);
|
||||
log.debug("Version code2: " + versionCode2);
|
||||
log.debug("Version code3: " + versionCode3);
|
||||
log.debug("Version code4: " + versionCode4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Calendar;
|
|||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.RecordTypes;
|
||||
|
||||
public class MsgSetCarbsEntry extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(MsgSetCarbsEntry.class);
|
||||
|
|
|
@ -25,7 +25,7 @@ public class MsgSettingBasal extends MessageBase {
|
|||
for (int index = 0; index < 24; index++) {
|
||||
int basal = intFromBuff(bytes, 2 * index, 2);
|
||||
if (basal < 10) basal = 0;
|
||||
pump.pumpProfiles[pump.activeProfile][index] = basal / 100d;
|
||||
pump.pumpProfiles[pump.activeProfile][index] = basal / 100 / 24d; // in units/day
|
||||
}
|
||||
|
||||
if (Config.logDanaMessageDetail)
|
||||
|
|
|
@ -32,7 +32,7 @@ public class MsgSettingBasalProfileAll extends MessageBase {
|
|||
for (int index = 0; index < 48; index++) {
|
||||
int basal = intFromBuff(bytes, 107 * profile + 2 * index + 1, 2);
|
||||
if (basal < 10) basal = 0;
|
||||
pump.pumpProfiles[position][index] = basal / 100d;
|
||||
pump.pumpProfiles[position][index] = basal / 100 / 24d; // in units/day
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -45,7 +45,7 @@ public class MsgSettingBasalProfileAll extends MessageBase {
|
|||
int basal = intFromBuff(bytes, 59 * profile + 2 * index + 1, 2);
|
||||
if (basal < 10) basal = 0;
|
||||
log.debug("position " + position + " index " + index);
|
||||
pump.pumpProfiles[position][index] = basal / 100d;
|
||||
pump.pumpProfiles[position][index] = basal / 100 / 24d; // in units/day
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.Date;
|
|||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPump;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.07.2016.
|
||||
|
@ -20,17 +21,18 @@ public class MsgSettingShippingInfo extends MessageBase {
|
|||
}
|
||||
|
||||
public void handleMessage(byte[] bytes) {
|
||||
DanaRKoreanPlugin.getDanaRPump().serialNumber = stringFromBuff(bytes, 0, 10);
|
||||
DanaRKoreanPlugin.getDanaRPump().shippingDate = dateFromBuff(bytes, 10);
|
||||
DanaRKoreanPlugin.getDanaRPump().shippingCountry = asciiStringFromBuff(bytes, 13, 3);
|
||||
if (DanaRKoreanPlugin.getDanaRPump().shippingDate.getTime() > new Date(116, 4, 1).getTime()) {
|
||||
DanaRKoreanPlugin.getDanaRPump().isNewPump = true;
|
||||
DanaRKoreanPump pump = DanaRKoreanPlugin.getDanaRPump();
|
||||
pump.serialNumber = stringFromBuff(bytes, 0, 10);
|
||||
pump.shippingDate = dateFromBuff(bytes, 10);
|
||||
pump.shippingCountry = asciiStringFromBuff(bytes, 13, 3);
|
||||
if (pump.shippingDate.getTime() > new Date(116, 4, 1).getTime()) {
|
||||
pump.isNewPump = true;
|
||||
} else
|
||||
DanaRKoreanPlugin.getDanaRPump().isNewPump = false;
|
||||
pump.isNewPump = false;
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Serial number: " + DanaRKoreanPlugin.getDanaRPump().serialNumber);
|
||||
log.debug("Shipping date: " + DanaRKoreanPlugin.getDanaRPump().shippingDate);
|
||||
log.debug("Shipping country: " + DanaRKoreanPlugin.getDanaRPump().shippingCountry);
|
||||
log.debug("Serial number: " + pump.serialNumber);
|
||||
log.debug("Shipping date: " + pump.shippingDate);
|
||||
log.debug("Shipping country: " + pump.shippingCountry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ public class MsgStatus extends MessageBase {
|
|||
DanaRKoreanPlugin.getDanaRPump().extendedBolusMinutes = intFromBuff(bytes, 4, 2);
|
||||
DanaRKoreanPlugin.getDanaRPump().extendedBolusAmount = intFromBuff(bytes, 6, 2) / 100d;
|
||||
Double lastBolusAmount = intFromBuff(bytes, 13, 2) / 100d;
|
||||
if (lastBolusAmount != 0d) {
|
||||
DanaRKoreanPlugin.getDanaRPump().lastBolusTime = dateTimeFromBuff(bytes, 8);
|
||||
DanaRKoreanPlugin.getDanaRPump().lastBolusAmount = lastBolusAmount;
|
||||
}
|
||||
// if (lastBolusAmount != 0d) {
|
||||
// DanaRKoreanPlugin.getDanaRPump().lastBolusTime = dateTimeFromBuff(bytes, 8);
|
||||
// DanaRKoreanPlugin.getDanaRPump().lastBolusAmount = lastBolusAmount;
|
||||
// }
|
||||
DanaRKoreanPlugin.getDanaRPump().iob = intFromBuff(bytes, 15, 2) / 100d;
|
||||
|
||||
if (Config.logDanaMessageDetail) {
|
||||
|
@ -31,8 +31,8 @@ public class MsgStatus extends MessageBase {
|
|||
log.debug("Is extended bolus running: " + DanaRKoreanPlugin.getDanaRPump().isExtendedInProgress);
|
||||
log.debug("Extended bolus min: " + DanaRKoreanPlugin.getDanaRPump().extendedBolusMinutes);
|
||||
log.debug("Extended bolus amount: " + DanaRKoreanPlugin.getDanaRPump().extendedBolusAmount);
|
||||
log.debug("Last bolus time: " + DanaRKoreanPlugin.getDanaRPump().lastBolusTime);
|
||||
log.debug("Last bolus amount: " + DanaRKoreanPlugin.getDanaRPump().lastBolusAmount);
|
||||
// log.debug("Last bolus time: " + DanaRKoreanPlugin.getDanaRPump().lastBolusTime);
|
||||
// log.debug("Last bolus amount: " + DanaRKoreanPlugin.getDanaRPump().lastBolusAmount);
|
||||
log.debug("IOB: " + DanaRKoreanPlugin.getDanaRPump().iob);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,41 +16,23 @@ public class MsgStatusBasic extends MessageBase {
|
|||
}
|
||||
|
||||
public void handleMessage(byte[] bytes) {
|
||||
boolean pumpSuspended = intFromBuff(bytes, 0, 1) == 1;
|
||||
boolean calculatorEnabled = intFromBuff(bytes, 1, 1) == 1;
|
||||
double dailyTotalUnits = intFromBuff(bytes, 2, 3) / 750d;
|
||||
int maxDailyTotalUnits = intFromBuff(bytes, 5, 2) / 100;
|
||||
double reservoirRemainingUnits = intFromBuff(bytes, 7, 3) / 750d;
|
||||
boolean bolusBlocked = intFromBuff(bytes, 10, 1) == 1;
|
||||
double currentBasal = intFromBuff(bytes, 11, 2) / 100d;
|
||||
int tempBasalPercent = intFromBuff(bytes, 13, 1);
|
||||
boolean isExtendedInProgress = intFromBuff(bytes, 14, 1) == 1;
|
||||
boolean isTempBasalInProgress = intFromBuff(bytes, 15, 1) == 1;
|
||||
int batteryRemaining = intFromBuff(bytes, 20, 1);
|
||||
double currentBasal = intFromBuff(bytes, 0, 2) / 100 / 24d; // in units/day
|
||||
int batteryRemaining = intFromBuff(bytes, 2, 1);
|
||||
double reservoirRemainingUnits = intFromBuff(bytes, 3, 3) / 750d;
|
||||
double dailyTotalUnits = intFromBuff(bytes, 6, 3) / 750d;
|
||||
int maxDailyTotalUnits = intFromBuff(bytes, 9, 2) / 100;
|
||||
|
||||
DanaRKoreanPlugin.getDanaRPump().pumpSuspended = pumpSuspended;
|
||||
DanaRKoreanPlugin.getDanaRPump().calculatorEnabled = calculatorEnabled;
|
||||
DanaRKoreanPlugin.getDanaRPump().dailyTotalUnits = dailyTotalUnits;
|
||||
DanaRKoreanPlugin.getDanaRPump().maxDailyTotalUnits = maxDailyTotalUnits;
|
||||
DanaRKoreanPlugin.getDanaRPump().reservoirRemainingUnits = reservoirRemainingUnits;
|
||||
DanaRKoreanPlugin.getDanaRPump().bolusBlocked = bolusBlocked;
|
||||
DanaRKoreanPlugin.getDanaRPump().currentBasal = currentBasal;
|
||||
DanaRKoreanPlugin.getDanaRPump().tempBasalPercent = tempBasalPercent;
|
||||
DanaRKoreanPlugin.getDanaRPump().isExtendedInProgress = isExtendedInProgress;
|
||||
DanaRKoreanPlugin.getDanaRPump().isTempBasalInProgress = isTempBasalInProgress;
|
||||
DanaRKoreanPlugin.getDanaRPump().batteryRemaining = batteryRemaining;
|
||||
|
||||
if (Config.logDanaMessageDetail) {
|
||||
log.debug("Pump suspended: " + pumpSuspended);
|
||||
log.debug("Calculator enabled: " + calculatorEnabled);
|
||||
log.debug("Daily total units: " + dailyTotalUnits);
|
||||
log.debug("Max daily total units: " + maxDailyTotalUnits);
|
||||
log.debug("Reservoir remaining units: " + reservoirRemainingUnits);
|
||||
log.debug("Bolus blocked: " + bolusBlocked);
|
||||
log.debug("Current basal: " + currentBasal);
|
||||
log.debug("Current temp basal percent: " + tempBasalPercent);
|
||||
log.debug("Is extended bolus running: " + isExtendedInProgress);
|
||||
log.debug("Is temp basal running: " + isTempBasalInProgress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,8 @@ public class MsgStatusBolusExtended extends MessageBase {
|
|||
|
||||
double extendedBolusAmount = intFromBuff(bytes, 2, 2) / 100d;
|
||||
int extendedBolusSoFarInSecs = intFromBuff(bytes, 4, 3);
|
||||
int extendedBolusDeliveryPulse = intFromBuff(bytes, 7, 2);
|
||||
int isEasyUIUserSleep = intFromBuff(bytes, 9, 1);
|
||||
|
||||
int extendedBolusSoFarInMinutes = extendedBolusSoFarInSecs / 60;
|
||||
double extendedBolusAbsoluteRate = isExtendedInProgress ? extendedBolusAmount / extendedBolusMinutes * 60 : 0d;
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.DanaRKorean.comm;
|
||||
|
||||
/**
|
||||
* Created by mike on 28.05.2016.
|
||||
*/
|
||||
public class RecordTypes {
|
||||
public static final byte RECORD_TYPE_BOLUS = (byte) 0x01;
|
||||
public static final byte RECORD_TYPE_DAILY = (byte) 0x02;
|
||||
public static final byte RECORD_TYPE_PRIME = (byte) 0x03;
|
||||
public static final byte RECORD_TYPE_ERROR = (byte) 0x04;
|
||||
public static final byte RECORD_TYPE_ALARM = (byte) 0x05;
|
||||
public static final byte RECORD_TYPE_GLUCOSE = (byte) 0x06;
|
||||
public static final byte RECORD_TYPE_CARBO = (byte) 0x08;
|
||||
public static final byte RECORD_TYPE_REFILL = (byte) 0x09;
|
||||
public static final byte RECORD_TYPE_SUSPEND = (byte) 0x0B;
|
||||
public static final byte RECORD_TYPE_BASALHOUR = (byte) 0x0C;
|
||||
public static final byte RECORD_TYPE_TB = (byte) 0x0D;
|
||||
public static final byte RECORD_TYPE_TEMP_BASAL = (byte) 0x14;
|
||||
}
|
|
@ -27,6 +27,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
|||
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.utils.ToastUtils;
|
||||
|
||||
public class KeepAliveReceiver extends BroadcastReceiver {
|
||||
|
@ -51,6 +52,18 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
|||
t.start();
|
||||
}
|
||||
}
|
||||
final DanaRKoreanPlugin danaRKoreanPlugin = (DanaRKoreanPlugin) MainApp.getSpecificPlugin(DanaRKoreanPlugin.class);
|
||||
if (danaRKoreanPlugin != null && Config.DANAR && danaRKoreanPlugin.isEnabled(PluginBase.PUMP)) {
|
||||
if (danaRKoreanPlugin.getDanaRPump().lastConnection.getTime() + 30 * 60 * 1000L < new Date().getTime() && !danaRKoreanPlugin.isConnected() && !danaRKoreanPlugin.isConnecting()) {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
danaRKoreanPlugin.doConnect("KeepAlive");
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
}
|
||||
|
||||
wl.release();
|
||||
}
|
||||
|
|
|
@ -376,4 +376,5 @@
|
|||
<string name="pumpshutdown">Pump Shutdown</string>
|
||||
<string name="batterydischarged">Pump Battery Discharged</string>
|
||||
<string name="danarkoreanpump">DanaR Korean</string>
|
||||
<string name="wrongpumpdriverselected">Wrong pump driver selected</string>
|
||||
</resources>
|
||||
|
|
|
@ -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" />
|
||||
|
@ -66,14 +66,6 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/full/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/full/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/full/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFull/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFull/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFull/assets" type="java-test-resource" />
|
||||
|
@ -82,6 +74,14 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/testFull/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFull/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFull/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFull/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/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/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" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<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" />
|
||||
<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" />
|
||||
|
@ -122,6 +114,14 @@
|
|||
<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" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<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/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
|
|
Loading…
Reference in a new issue