use of com.google.android.gms.wearable.DataMap in project android_packages_apps_GmsCore by microg.
the class WearableLocationService method onMessageReceived.
@Override
public void onMessageReceived(MessageEvent messageEvent) {
if (messageEvent.getPath().equals(PATH_LOCATION_REQUESTS)) {
DataMap dataMap = DataMap.fromByteArray(messageEvent.getData());
onLocationRequests(messageEvent.getSourceNodeId(), readLocationRequestList(dataMap, this), dataMap.getBoolean("TRIGGER_UPDATE", false));
} else if (messageEvent.getPath().equals(PATH_CAPABILITY_QUERY)) {
onCapabilityQuery(messageEvent.getSourceNodeId());
}
}
use of com.google.android.gms.wearable.DataMap in project Memento-Calendar by alexstyl.
the class ContactEventsProviderService method createComplicationData.
private ComplicationData createComplicationData(DataItem item, int dataType) {
DataMap dataMap = DataMapItem.fromDataItem(item).getDataMap();
long date = dataMap.getLong(SharedConstants.KEY_DATE);
ArrayList<String> namesList = dataMap.getStringArrayList(SharedConstants.KEY_CONTACTS_NAMES);
return createComplicationData(dataType, date, namesList);
}
use of com.google.android.gms.wearable.DataMap in project ETSMobile-Android2 by ApplETS.
the class Seances method putData.
public DataMap putData() {
DataMap map = new DataMap();
map.putString("dateDebut", dateDebut);
map.putString("dateFin", dateFin);
map.putString("coursGroupe", coursGroupe);
map.putString("nomActivite", nomActivite);
map.putString("local", local);
map.putString("descriptionActivite", descriptionActivite);
map.putString("libelleCours", libelleCours);
return map;
}
use of com.google.android.gms.wearable.DataMap in project Memento-Calendar by alexstyl.
the class ContactEventsActivity method displayDataItem.
private void displayDataItem(DataItem item) {
DataMap dataMap = DataMapItem.fromDataItem(item).getDataMap();
long date = dataMap.getLong(SharedConstants.KEY_DATE);
CharSequence dateString = formatDate(date);
ArrayList<String> namesList = dataMap.getStringArrayList(SharedConstants.KEY_CONTACTS_NAMES);
dateText.setText(dateString);
namesText.setText(StringUtils.join(namesList, "\n"));
emptyText.setVisibility(View.GONE);
eventContainer.setVisibility(View.VISIBLE);
}
use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.
the class ListenerService method syncBgData.
private synchronized void syncBgData(DataMap dataMap, Context context) {
// KS
Log.d(TAG, "syncBGData");
boolean changed = false;
int battery = dataMap.getInt("battery");
ArrayList<DataMap> entries = dataMap.getDataMapArrayList("entries");
Log.d(TAG, "syncBGData add BgReading Table battery=" + battery);
if (entries != null) {
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().registerTypeAdapter(Date.class, new DateTypeAdapter()).serializeSpecialFloatingPointValues().create();
Log.d(TAG, "syncBGData add BgReading Table entries count=" + entries.size());
// ensure database has already been initialized
Sensor.InitDb(context);
Sensor sensor = Sensor.currentSensor();
if (sensor != null) {
for (DataMap entry : entries) {
if (entry != null) {
String bgrecord = entry.getString("bgs");
if (bgrecord != null) {
BgReading bgData = gson.fromJson(bgrecord, BgReading.class);
/* // TODO this is a hack to use display glucose but it is incomplete regarding delta
if (bgData.dg_mgdl > 0) {
bgData.calculated_value = bgData.dg_mgdl;
bgData.calculated_value_slope = bgData.dg_slope;
// TODO delta missing???
}
*/
BgReading exists = BgReading.getForTimestampExists(bgData.timestamp);
exists = exists != null ? exists : BgReading.findByUuid(bgData.uuid);
String calibrationUuid = entry.getString("calibrationUuid");
if (exists != null) {
Log.d(TAG, "syncBGData BG already exists for uuid=" + bgData.uuid + " timestamp=" + bgData.timestamp + " timeString=" + JoH.dateTimeText(bgData.timestamp));
Log.d(TAG, "syncBGData exists timeString=" + JoH.dateTimeText(exists.timestamp) + " exists.calibration.uuid=" + exists.calibration.uuid + " exists=" + exists.toS());
exists.filtered_calculated_value = bgData.filtered_calculated_value;
exists.calculated_value = bgData.calculated_value;
exists.hide_slope = bgData.hide_slope;
exists.filtered_data = bgData.filtered_data;
exists.raw_data = bgData.raw_data;
exists.raw_calculated = bgData.raw_calculated;
exists.calculated_value_slope = bgData.calculated_value_slope;
exists.age_adjusted_raw_value = bgData.age_adjusted_raw_value;
exists.calibration_flag = bgData.calibration_flag;
exists.ignoreForStats = bgData.ignoreForStats;
exists.time_since_sensor_started = bgData.time_since_sensor_started;
exists.ra = bgData.ra;
exists.rb = bgData.rb;
exists.rc = bgData.rc;
exists.a = bgData.a;
exists.b = bgData.b;
exists.c = bgData.c;
exists.noise = bgData.noise;
exists.time_since_sensor_started = bgData.time_since_sensor_started;
Calibration calibration = Calibration.byuuid(calibrationUuid);
calibration = calibration != null ? calibration : Calibration.byuuid(exists.calibration_uuid);
if (calibration != null) {
exists.calibration = calibration;
exists.calibration_uuid = calibration.uuid;
exists.sensor = sensor;
exists.sensor_uuid = sensor.uuid;
if (exists.calculated_value != bgData.calculated_value) {
changed = true;
}
exists.save();
} else {
Log.e(TAG, "syncBGData existing BgReading calibrationUuid not found by byuuid; calibrationUuid=" + calibrationUuid + " bgData.calibration_uuid=" + bgData.calibration_uuid + " bgData.uuid=" + bgData.uuid + " timeString=" + JoH.dateTimeText(bgData.timestamp));
}
} else {
Calibration calibration = Calibration.byuuid(calibrationUuid);
calibration = calibration != null ? calibration : Calibration.byuuid(bgData.calibration_uuid);
if (calibration != null) {
Log.d(TAG, "syncBGData add BG; does NOT exist for uuid=" + bgData.uuid + " timestamp=" + bgData.timestamp + " timeString=" + JoH.dateTimeText(bgData.timestamp));
bgData.calibration = calibration;
bgData.calibration_uuid = calibration.uuid;
bgData.sensor = sensor;
bgData.sensor_uuid = sensor.uuid;
changed = true;
bgData.save();
} else {
Log.e(TAG, "syncBGData new BgReading calibrationUuid not found by byuuid; calibrationUuid=" + calibrationUuid + " bgData.calibration_uuid=" + bgData.calibration_uuid + " bgData.uuid=" + bgData.uuid + " timeString=" + JoH.dateTimeText(bgData.timestamp));
}
}
}
}
}
} else {
Log.d(TAG, "syncBGData No Active Sensor!! Request WEARABLE_INITDB_PATH");
sendData(WEARABLE_INITDB_PATH, null);
}
}
if (changed) {
// otherwise, wait for doBackground ACTION_RESEND
Log.d(TAG, "syncBGData BG data has changed, refresh watchface, phone battery=" + battery);
resendData(getApplicationContext(), battery);
CustomComplicationProviderService.refresh();
} else
Log.d(TAG, "syncBGData BG data has NOT changed, do not refresh watchface, phone battery=" + battery);
}
Aggregations