Search in sources :

Example 41 with DataMap

use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.

the class BgSendQueue method dataMap.

private static DataMap dataMap(BgReading bg, SharedPreferences sPrefs, BgGraphBuilder bgGraphBuilder, Context context, int battery) {
    // KS
    Double highMark = Double.parseDouble(sPrefs.getString("highValue", "140"));
    Double lowMark = Double.parseDouble(sPrefs.getString("lowValue", "60"));
    DataMap dataMap = new DataMap();
    // int battery = BgSendQueue.getBatteryLevel(context.getApplicationContext());
    dataMap.putString("sgvString", bgGraphBuilder.unitized_string(bg.calculated_value));
    dataMap.putString("slopeArrow", bg.slopeArrow());
    // TODO: change that to long (was like that in NW)
    dataMap.putDouble("timestamp", bg.timestamp);
    dataMap.putString("delta", bgGraphBuilder.unitizedDeltaString(true, true));
    dataMap.putString("battery", "" + battery);
    dataMap.putLong("sgvLevel", sgvLevel(bg.calculated_value, sPrefs, bgGraphBuilder));
    dataMap.putInt("batteryLevel", (battery >= 30) ? 1 : 0);
    dataMap.putDouble("sgvDouble", bg.calculated_value);
    dataMap.putDouble("high", inMgdl(highMark, sPrefs));
    dataMap.putDouble("low", inMgdl(lowMark, sPrefs));
    // Used in DexCollectionService
    dataMap.putInt("bridge_battery", sPrefs.getInt("bridge_battery", -1));
    // }
    return dataMap;
}
Also used : DataMap(com.google.android.gms.wearable.DataMap)

Example 42 with DataMap

use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.

the class HeartRateService method dataMap.

// this is pretty inefficient - maybe eventually replace with protobuf
private static DataMap dataMap(HeartRate log) {
    final DataMap dataMap = new DataMap();
    final String json = log.toS();
    dataMap.putString("entry", json);
    return dataMap;
}
Also used : DataMap(com.google.android.gms.wearable.DataMap)

Example 43 with DataMap

use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.

the class G5BaseService method getWatchStatus.

public static DataMap getWatchStatus() {
    DataMap dataMap = new DataMap();
    dataMap.putString("lastState", lastState);
    dataMap.putLong("timestamp", static_last_timestamp);
    return dataMap;
}
Also used : DataMap(com.google.android.gms.wearable.DataMap)

Example 44 with DataMap

use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.

the class Simulation method Approve.

public void Approve(View myview) {
    if (watchkeypad) {
        // Treatments.create(carbs, insulin, thisnotes, new Date().getTime());
        DataMap dataMap = new DataMap();
        dataMap.putDouble("timeoffset", timeoffset);
        dataMap.putDouble("carbs", carbs);
        dataMap.putDouble("insulin", insulin);
        dataMap.putDouble("bloodtest", bloodtest);
        dataMap.putString("notes", thisnotes);
        // dataMap.putLong("timestamp", System.currentTimeMillis());
        ListenerService.createTreatment(dataMap, this);
    } else
        SendData(this, WEARABLE_APPROVE_TREATMENT, null);
    finish();
}
Also used : DataMap(com.google.android.gms.wearable.DataMap)

Example 45 with DataMap

use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.

the class DexCollectionService method getWatchStatus.

public static DataMap getWatchStatus() {
    DataMap dataMap = new DataMap();
    dataMap.putString("lastState", lastState);
    if (last_transmitter_Data != null)
        dataMap.putLong("timestamp", last_transmitter_Data.timestamp);
    dataMap.putInt("mStaticState", mStaticState);
    dataMap.putInt("last_battery_level", last_battery_level);
    dataMap.putLong("retry_time", retry_time);
    dataMap.putLong("failover_time", failover_time);
    dataMap.putString("static_last_hexdump", static_last_hexdump);
    dataMap.putString("static_last_sent_hexdump", static_last_sent_hexdump);
    return dataMap;
}
Also used : DataMap(com.google.android.gms.wearable.DataMap)

Aggregations

DataMap (com.google.android.gms.wearable.DataMap)157 Date (java.util.Date)42 ArrayList (java.util.ArrayList)38 Gson (com.google.gson.Gson)20 BgReading (com.eveningoutpost.dexdrip.Models.BgReading)18 GsonBuilder (com.google.gson.GsonBuilder)18 DateTypeAdapter (com.google.gson.internal.bind.DateTypeAdapter)18 Intent (android.content.Intent)17 Sensor (com.eveningoutpost.dexdrip.Models.Sensor)14 SuppressLint (android.annotation.SuppressLint)12 PendingIntent (android.app.PendingIntent)11 Context (android.content.Context)8 Calibration (com.eveningoutpost.dexdrip.Models.Calibration)8 Treatments (com.eveningoutpost.dexdrip.Models.Treatments)8 Bundle (android.os.Bundle)6 HeartRate (com.eveningoutpost.dexdrip.Models.HeartRate)6 Paint (android.graphics.Paint)5 BloodTest (com.eveningoutpost.dexdrip.Models.BloodTest)5 BroadcastReceiver (android.content.BroadcastReceiver)4 SharedPreferences (android.content.SharedPreferences)4