danar history db support

This commit is contained in:
Milos Kozak 2016-07-21 15:10:42 +02:00
parent 1c0edb151e
commit 73ef2d7684
9 changed files with 80 additions and 86 deletions

View file

@ -20,6 +20,7 @@ public class Constants {
public static final Integer notificationID = 556677;
public static final int hoursToKeepInDatabase = 72;
public static final int daysToKeepHistoryInDatabase = 30;
public static final long keepAliveMsecs = 30 * 60 * 1000L;

View file

@ -13,7 +13,7 @@ import info.nightscout.androidaps.Constants;
import info.nightscout.client.data.NSSgv;
import info.nightscout.utils.DecimalFormatter;
@DatabaseTable(tableName = "BgReadings")
@DatabaseTable(tableName = DatabaseHelper.DATABASE_BGREADINGS)
public class BgReading implements DataPointInterface {
private static Logger log = LoggerFactory.getLogger(BgReading.class);

View file

@ -5,8 +5,8 @@ import com.j256.ormlite.table.DatabaseTable;
import java.util.Date;
@DatabaseTable(tableName = "History")
public class HistoryRecord {
@DatabaseTable(tableName = DatabaseHelper.DATABASE_DANARHISTORY)
public class DanaRHistoryRecord {
@DatabaseField(useGetSet = true)
private String _id;
@ -41,7 +41,7 @@ public class HistoryRecord {
@DatabaseField(useGetSet = true)
private String recordAlarm;
public HistoryRecord() {
public DanaRHistoryRecord() {
this.recordDate = 0;
this.recordValue = 0.0;
this.bolusType = "None";

View file

@ -38,6 +38,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
private static Logger log = LoggerFactory.getLogger(DatabaseHelper.class);
public static final String DATABASE_NAME = "AndroidAPSDb";
public static final String DATABASE_BGREADINGS = "BgReadings";
public static final String DATABASE_TEMPBASALS = "TempBasals";
public static final String DATABASE_TREATMENTS = "Treatments";
public static final String DATABASE_DANARHISTORY = "DanaRHistory";
private static final int DATABASE_VERSION = 2;
@ -53,7 +57,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.createTableIfNotExists(connectionSource, TempBasal.class);
TableUtils.createTableIfNotExists(connectionSource, Treatment.class);
TableUtils.createTableIfNotExists(connectionSource, BgReading.class);
TableUtils.createTableIfNotExists(connectionSource, HistoryRecord.class);
TableUtils.createTableIfNotExists(connectionSource, DanaRHistoryRecord.class);
} catch (SQLException e) {
log.error(DatabaseHelper.class.getName(), "Can't create database", e);
throw new RuntimeException(e);
@ -67,7 +71,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.dropTable(connectionSource, TempBasal.class, true);
TableUtils.dropTable(connectionSource, Treatment.class, true);
TableUtils.dropTable(connectionSource, BgReading.class, true);
TableUtils.dropTable(connectionSource, HistoryRecord.class, true);
TableUtils.dropTable(connectionSource, DanaRHistoryRecord.class, true);
onCreate(database, connectionSource);
} catch (SQLException e) {
log.error(DatabaseHelper.class.getName(), "Can't drop databases", e);
@ -85,21 +89,21 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public void cleanUpDatabases() {
// TODO: call it somewhere
log.debug("Before BgReadings size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), "BgReadings"));
log.debug("Before BgReadings size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_BGREADINGS));
getWritableDatabase().delete("BgReadings", "timeIndex" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
log.debug("After BgReadings size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), "BgReadings"));
log.debug("After BgReadings size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_BGREADINGS));
log.debug("Before TempBasals size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), "TempBasals"));
log.debug("Before TempBasals size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TEMPBASALS));
getWritableDatabase().delete("TempBasals", "timeIndex" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
log.debug("After TempBasals size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), "TempBasals"));
log.debug("After TempBasals size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TEMPBASALS));
log.debug("Before Treatments size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), "Treatments"));
log.debug("Before Treatments size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TREATMENTS));
getWritableDatabase().delete("Treatments", "timeIndex" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
log.debug("After Treatments size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), "Treatments"));
log.debug("After Treatments size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TREATMENTS));
log.debug("Before History size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), "History"));
getWritableDatabase().delete("History", "recordDate" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
log.debug("After History size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), "History"));
log.debug("Before History size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_DANARHISTORY));
getWritableDatabase().delete("History", "recordDate" + " < '" + (new Date().getTime() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
log.debug("After History size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_DANARHISTORY));
}
public void resetDatabases() {
@ -107,11 +111,11 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.dropTable(connectionSource, TempBasal.class, true);
TableUtils.dropTable(connectionSource, Treatment.class, true);
TableUtils.dropTable(connectionSource, BgReading.class, true);
TableUtils.dropTable(connectionSource, HistoryRecord.class, true);
TableUtils.dropTable(connectionSource, DanaRHistoryRecord.class, true);
TableUtils.createTableIfNotExists(connectionSource, TempBasal.class);
TableUtils.createTableIfNotExists(connectionSource, Treatment.class);
TableUtils.createTableIfNotExists(connectionSource, BgReading.class);
TableUtils.createTableIfNotExists(connectionSource, HistoryRecord.class);
TableUtils.createTableIfNotExists(connectionSource, DanaRHistoryRecord.class);
MainApp.bus().post(new EventNewBG());
MainApp.bus().post(new EventTreatmentChange());
MainApp.bus().post(new EventTempBasalChange());
@ -142,8 +146,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return getDao(BgReading.class);
}
public Dao<HistoryRecord, String> getDaoHistory() throws SQLException {
return getDao(HistoryRecord.class);
public Dao<DanaRHistoryRecord, String> getDaoHistory() throws SQLException {
return getDao(DanaRHistoryRecord.class);
}
/*

View file

@ -16,7 +16,7 @@ import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
import info.nightscout.client.data.NSProfile;
import info.nightscout.utils.DecimalFormatter;
@DatabaseTable(tableName = "TempBasals")
@DatabaseTable(tableName = DatabaseHelper.DATABASE_TEMPBASALS)
public class TempBasal {
private static Logger log = LoggerFactory.getLogger(TempBasal.class);

View file

@ -19,7 +19,7 @@ import info.nightscout.client.data.NSProfile;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
@DatabaseTable(tableName = "Treatments")
@DatabaseTable(tableName = DatabaseHelper.DATABASE_TREATMENTS)
public class Treatment implements DataPointWithLabelInterface {
private static Logger log = LoggerFactory.getLogger(Treatment.class);

View file

@ -1,12 +1,5 @@
package info.nightscout.androidaps.plugins.DanaR.History;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.preference.PreferenceManager;
import com.j256.ormlite.dao.Dao;
import org.json.JSONException;
@ -15,13 +8,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.HistoryRecord;
import info.nightscout.androidaps.db.DanaRHistoryRecord;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
import info.nightscout.androidaps.plugins.DanaR.comm.RecordTypes;
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRSyncStatus;
@ -35,7 +26,7 @@ import info.nightscout.utils.ToastUtils;
public class NSHistorySync {
private static Logger log = LoggerFactory.getLogger(NSHistorySync.class);
private Dao<HistoryRecord, String> daoHistoryRecords;
private Dao<DanaRHistoryRecord, String> daoHistoryRecords;
public final int SYNC_BOLUS = 0b00000001;
public final int SYNC_ERROR = 0b00000010;
@ -46,7 +37,7 @@ public class NSHistorySync {
public final int SYNC_BASALOURS = 0b01000000;
public final int SYNC_ALL = 0b11111111;
public NSHistorySync(Dao<HistoryRecord, String> daoHistoryRecords) {
public NSHistorySync(Dao<DanaRHistoryRecord, String> daoHistoryRecords) {
this.daoHistoryRecords = daoHistoryRecords;
}
@ -65,7 +56,7 @@ public class NSHistorySync {
long uploaded = 0;
log.debug("Database contains " + records + " records");
EventDanaRSyncStatus ev = new EventDanaRSyncStatus();
for (HistoryRecord record : daoHistoryRecords) {
for (DanaRHistoryRecord record : daoHistoryRecords) {
processing++;
if (record.get_id() != null) continue;
//log.debug(record.getBytes());
@ -77,19 +68,19 @@ public class NSHistorySync {
switch (record.getBolusType()) {
case "S":
log.debug("Syncing standard bolus record " + record.getRecordValue() + "U " + DateUtil.toISOString(record.getRecordDate()));
nsrec.put("danarMessage", record.getBytes());
nsrec.put("DANARMESSAGE", record.getBytes());
nsrec.put("eventType", "Meal Bolus");
nsrec.put("insulin", record.getRecordValue());
nsrec.put("created_at", DateUtil.toISOString(record.getRecordDate()));
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
configBuilderFragment.uploadCareportalEntryToNS(nsrec);
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "S bolus";
break;
case "E":
if (record.getRecordDuration() > 0) {
log.debug("Syncing extended bolus record " + record.getRecordValue() + "U " + DateUtil.toISOString(record.getRecordDate()));
nsrec.put("danarMessage", record.getBytes());
nsrec.put("DANARMESSAGE", record.getBytes());
nsrec.put("eventType", "Combo Bolus");
nsrec.put("insulin", 0);
nsrec.put("duration", record.getRecordDuration());
@ -100,7 +91,7 @@ public class NSHistorySync {
cal.add(Calendar.MINUTE, -1 * record.getRecordDuration());
nsrec.put("created_at", DateUtil.toISOString(cal.getTime()));
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
configBuilderFragment.uploadCareportalEntryToNS(nsrec);
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "E bolus";
} else {
@ -109,20 +100,20 @@ public class NSHistorySync {
break;
case "DS":
log.debug("Syncing dual(S) bolus record " + record.getRecordValue() + "U " + DateUtil.toISOString(record.getRecordDate()));
nsrec.put("danarMessage", record.getBytes());
nsrec.put("DANARMESSAGE", record.getBytes());
nsrec.put("eventType", "Combo Bolus");
nsrec.put("insulin", record.getRecordValue());
nsrec.put("splitNow", 100);
nsrec.put("splitExt", 0);
nsrec.put("created_at", DateUtil.toISOString(record.getRecordDate()));
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
configBuilderFragment.uploadCareportalEntryToNS(nsrec);
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "DS bolus";
break;
case "DE":
log.debug("Syncing dual(E) bolus record " + record.getRecordValue() + "U " + DateUtil.toISOString(record.getRecordDate()));
nsrec.put("danarMessage", record.getBytes());
nsrec.put("DANARMESSAGE", record.getBytes());
nsrec.put("eventType", "Combo Bolus");
nsrec.put("duration", record.getRecordDuration());
nsrec.put("relative", record.getRecordValue() / record.getRecordDuration() * 60);
@ -132,7 +123,7 @@ public class NSHistorySync {
cal.add(Calendar.MINUTE, -1 * record.getRecordDuration());
nsrec.put("created_at", DateUtil.toISOString(cal.getTime()));
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
configBuilderFragment.uploadCareportalEntryToNS(nsrec);
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "DE bolus";
break;
@ -144,37 +135,37 @@ public class NSHistorySync {
case RecordTypes.RECORD_TYPE_ERROR:
if ((what & SYNC_ERROR) == 0) break;
log.debug("Syncing error record " + DateUtil.toISOString(record.getRecordDate()));
nsrec.put("danarMessage", record.getBytes());
nsrec.put("DANARMESSAGE", record.getBytes());
nsrec.put("eventType", "Note");
nsrec.put("notes", "Error");
nsrec.put("created_at", DateUtil.toISOString(record.getRecordDate()));
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
configBuilderFragment.uploadCareportalEntryToNS(nsrec);
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "error";
break;
case RecordTypes.RECORD_TYPE_REFILL:
if ((what & SYNC_REFILL) == 0) break;
log.debug("Syncing refill record " + record.getRecordValue() + " " + DateUtil.toISOString(record.getRecordDate()));
nsrec.put("danarMessage", record.getBytes());
nsrec.put("DANARMESSAGE", record.getBytes());
nsrec.put("eventType", "Insulin Change");
nsrec.put("notes", "Refill " + record.getRecordValue() + "U");
nsrec.put("created_at", DateUtil.toISOString(record.getRecordDate()));
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
configBuilderFragment.uploadCareportalEntryToNS(nsrec);
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "refill";
break;
case RecordTypes.RECORD_TYPE_BASALHOUR:
if ((what & SYNC_BASALOURS) == 0) break;
log.debug("Syncing basal hour record " + record.getRecordValue() + " " + DateUtil.toISOString(record.getRecordDate()));
nsrec.put("danarMessage", record.getBytes());
nsrec.put("DANARMESSAGE", record.getBytes());
nsrec.put("eventType", "Temp Basal");
nsrec.put("absolute", record.getRecordValue());
nsrec.put("duration", 60);
nsrec.put("created_at", DateUtil.toISOString(record.getRecordDate()));
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
configBuilderFragment.uploadCareportalEntryToNS(nsrec);
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "basal hour";
break;
@ -184,43 +175,43 @@ public class NSHistorySync {
case RecordTypes.RECORD_TYPE_GLUCOSE:
if ((what & SYNC_GLUCOSE) == 0) break;
log.debug("Syncing glucose record " + record.getRecordValue() + " " + DateUtil.toISOString(record.getRecordDate()));
nsrec.put("danarMessage", record.getBytes());
nsrec.put("DANARMESSAGE", record.getBytes());
nsrec.put("eventType", "BG Check");
nsrec.put("glucose", NSProfile.fromMgdlToUnits(record.getRecordValue(), profile.getUnits()));
nsrec.put("glucoseType", "Finger");
nsrec.put("created_at", DateUtil.toISOString(record.getRecordDate()));
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
configBuilderFragment.uploadCareportalEntryToNS(nsrec);
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "glucose";
break;
case RecordTypes.RECORD_TYPE_CARBO:
if ((what & SYNC_CARBO) == 0) break;
log.debug("Syncing carbo record " + record.getRecordValue() + "g " + DateUtil.toISOString(record.getRecordDate()));
nsrec.put("danarMessage", record.getBytes());
nsrec.put("DANARMESSAGE", record.getBytes());
nsrec.put("eventType", "Meal Bolus");
nsrec.put("carbs", record.getRecordValue());
nsrec.put("created_at", DateUtil.toISOString(record.getRecordDate()));
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
configBuilderFragment.uploadCareportalEntryToNS(nsrec);
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "carbo";
break;
case RecordTypes.RECORD_TYPE_ALARM:
if ((what & SYNC_ALARM) == 0) break;
log.debug("Syncing alarm record " + record.getRecordAlarm() + " " + DateUtil.toISOString(record.getRecordDate()));
nsrec.put("danarMessage", record.getBytes());
nsrec.put("DANARMESSAGE", record.getBytes());
nsrec.put("eventType", "Note");
nsrec.put("notes", "Alarm: " + record.getRecordAlarm());
nsrec.put("created_at", DateUtil.toISOString(record.getRecordDate()));
nsrec.put("enteredBy", MainApp.sResources.getString(R.string.app_name));
configBuilderFragment.uploadCareportalEntryToNS(nsrec);
ConfigBuilderFragment.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += "alarm";
break;
case RecordTypes.RECORD_TYPE_SUSPEND: // TODO: this too
case RecordTypes.RECORD_TYPE_DAILY:
case RecordTypes.RECORD_TYPE_PRIME:
case RecordTypes.RECORD_TYPE_SUSPEND:
// Ignore
break;
default:
@ -232,10 +223,8 @@ public class NSHistorySync {
ev.message = "Total " + uploaded + " records uploaded";
MainApp.bus().post(ev);
} catch (JSONException e) {
log.error(e.getMessage(), e);
} catch (SQLException e) {
log.error(e.getMessage(), e);
} catch (JSONException | SQLException e) {
e.printStackTrace();
}
}
}

View file

@ -9,7 +9,7 @@ import java.sql.SQLException;
import java.util.Date;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.db.HistoryRecord;
import info.nightscout.androidaps.db.DanaRHistoryRecord;
public class MsgHistoryAll extends MessageBase {
private static Logger log = LoggerFactory.getLogger(MsgHistoryAll.class);
@ -31,54 +31,54 @@ public class MsgHistoryAll extends MessageBase {
byte paramByte8 = (byte) intFromBuff(bytes, 7, 1);
double value = (double) intFromBuff(bytes, 8, 2);
HistoryRecord historyRecord = new HistoryRecord();
DanaRHistoryRecord danaRHistoryRecord = new DanaRHistoryRecord();
historyRecord.setRecordCode(recordCode);
historyRecord.setBytes(bytes);
danaRHistoryRecord.setRecordCode(recordCode);
danaRHistoryRecord.setBytes(bytes);
switch (recordCode) {
case RecordTypes.RECORD_TYPE_BOLUS:
historyRecord.setRecordDate(datetime);
danaRHistoryRecord.setRecordDate(datetime);
switch (0xF0 & paramByte8) {
case 0xA0:
historyRecord.setBolusType("DS");
danaRHistoryRecord.setBolusType("DS");
break;
case 0xC0:
historyRecord.setBolusType("E");
danaRHistoryRecord.setBolusType("E");
break;
case 0x80:
historyRecord.setBolusType("S");
danaRHistoryRecord.setBolusType("S");
break;
case 0x90:
historyRecord.setBolusType("DE");
danaRHistoryRecord.setBolusType("DE");
break;
default:
historyRecord.setBolusType("None");
danaRHistoryRecord.setBolusType("None");
break;
}
historyRecord.setRecordDuration(((int) paramByte8 & 0x0F) * 60 + (int) paramByte7);
historyRecord.setRecordValue(value * 0.01);
danaRHistoryRecord.setRecordDuration(((int) paramByte8 & 0x0F) * 60 + (int) paramByte7);
danaRHistoryRecord.setRecordValue(value * 0.01);
break;
case RecordTypes.RECORD_TYPE_DAILY:
historyRecord.setRecordDate(date);
historyRecord.setRecordDailyBasal((double) ((int) paramByte5 * 0xFF + (int) paramByte6) * 0.01);
historyRecord.setRecordDailyBolus((double) ((int) paramByte7 * 0xFF + (int) paramByte8) / 0.01);
danaRHistoryRecord.setRecordDate(date);
danaRHistoryRecord.setRecordDailyBasal((double) ((int) paramByte5 * 0xFF + (int) paramByte6) * 0.01);
danaRHistoryRecord.setRecordDailyBolus((double) ((int) paramByte7 * 0xFF + (int) paramByte8) / 0.01);
break;
case RecordTypes.RECORD_TYPE_PRIME:
case RecordTypes.RECORD_TYPE_ERROR:
case RecordTypes.RECORD_TYPE_REFILL:
case RecordTypes.RECORD_TYPE_BASALHOUR:
case RecordTypes.RECORD_TYPE_TB:
historyRecord.setRecordDate(datetimewihtsec);
historyRecord.setRecordValue(value * 0.01);
danaRHistoryRecord.setRecordDate(datetimewihtsec);
danaRHistoryRecord.setRecordValue(value * 0.01);
break;
case RecordTypes.RECORD_TYPE_GLUCOSE:
case RecordTypes.RECORD_TYPE_CARBO:
historyRecord.setRecordDate(datetimewihtsec);
historyRecord.setRecordValue(value);
danaRHistoryRecord.setRecordDate(datetimewihtsec);
danaRHistoryRecord.setRecordValue(value);
break;
case RecordTypes.RECORD_TYPE_ALARM:
historyRecord.setRecordDate(datetimewihtsec);
danaRHistoryRecord.setRecordDate(datetimewihtsec);
String strAlarm = "None";
switch ((int) paramByte8) {
case 67:
@ -94,21 +94,21 @@ public class MsgHistoryAll extends MessageBase {
strAlarm = "Shutdown";
break;
}
historyRecord.setRecordAlarm(strAlarm);
historyRecord.setRecordValue(value * 0.01);
danaRHistoryRecord.setRecordAlarm(strAlarm);
danaRHistoryRecord.setRecordValue(value * 0.01);
break;
case RecordTypes.RECORD_TYPE_SUSPEND:
historyRecord.setRecordDate(datetimewihtsec);
danaRHistoryRecord.setRecordDate(datetimewihtsec);
String strRecordValue = "Off";
if ((int) paramByte8 == 79)
strRecordValue = "On";
historyRecord.setStringRecordValue(strRecordValue);
danaRHistoryRecord.setStringRecordValue(strRecordValue);
break;
}
try {
Dao<HistoryRecord, String> daoHistoryRecords = MainApp.getDbHelper().getDaoHistory();
daoHistoryRecords.createIfNotExists(historyRecord);
Dao<DanaRHistoryRecord, String> daoHistoryRecords = MainApp.getDbHelper().getDaoHistory();
daoHistoryRecords.createIfNotExists(danaRHistoryRecord);
} catch (SQLException e) {
log.error(e.getMessage(), e);
}

View file

@ -4,7 +4,7 @@ package info.nightscout.androidaps.plugins.DanaR.events;
* Created by mike on 20.07.2016.
*/
public class EventDanaRSyncStatus {
public static String message;
public String message;
public EventDanaRSyncStatus() {
}