Java Code Examples for com.google.android.gms.wearable.DataMap#putDataMapArrayList()
The following examples show how to use
com.google.android.gms.wearable.DataMap#putDataMapArrayList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WatchUpdaterService.java From NightWatch with GNU General Public License v3.0 | 6 votes |
private void resendData() { if(googleApiClient != null && !googleApiClient.isConnected() && !googleApiClient.isConnecting()) { googleApiConnect(); } double startTime = new Date().getTime() - (60000 * 60 * 24); Bg last_bg = Bg.last(); List<Bg> graph_bgs = Bg.latestForGraph(60, startTime); if (!graph_bgs.isEmpty()) { DataMap entries = last_bg.dataMap(mPrefs); final ArrayList<DataMap> dataMaps = new ArrayList<>(graph_bgs.size()); for (Bg bg : graph_bgs) { dataMaps.add(bg.dataMap(mPrefs)); } entries.putDataMapArrayList("entries", dataMaps); new SendToDataLayerThread(WEARABLE_DATA_PATH, googleApiClient).execute(entries); } }
Example 2
Source File: WatchUpdaterService.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private void resendData(long since) { Log.d(TAG, "resendData ENTER"); forceGoogleApiConnect(); final long startTime = since == 0 ? new Date().getTime() - (60000 * 60 * 24) : since; Log.d(TAG, "resendData googleApiClient connected ENTER, sending since: " + JoH.dateTimeText(startTime)); final BgReading last_bg = BgReading.last(); if (last_bg != null) { List<BgReading> graph_bgs = BgReading.latestForGraph(60, startTime); BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(getApplicationContext()); if (!graph_bgs.isEmpty()) { final int battery = PowerStateReceiver.getBatteryLevel(getApplicationContext()); DataMap entries = dataMap(last_bg, mPrefs, bgGraphBuilder, battery); final ArrayList<DataMap> dataMaps = new ArrayList<>(graph_bgs.size()); for (BgReading bg : graph_bgs) { dataMaps.add(dataMap(bg, mPrefs, bgGraphBuilder, battery)); } entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putDataMapArrayList("entries", dataMaps); if (mPrefs.getBoolean("extra_status_line", false)) { entries.putString("extra_status_line", StatusLine.extraStatusLine()); } new SendToDataLayerThread(WEARABLE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, entries); } } }
Example 3
Source File: WatchUpdaterService.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private void sendAlertTypeData() {//KS try { forceGoogleApiConnect(); List<AlertType> alerts = AlertType.getAllActive(); if (alerts != null) { if (wear_integration) { Log.d(TAG, "sendAlertTypeData latest count = " + alerts.size()); final DataMap entries = new DataMap(); final ArrayList<DataMap> dataMaps = new ArrayList<>(alerts.size()); for (AlertType alert : alerts) { if (alert != null) { dataMaps.add(dataMap(alert, "alert")); } } entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putDataMapArrayList("entries", dataMaps); new SendToDataLayerThread(WEARABLE_ALERTTYPE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, entries); } else Log.d(TAG, "sendAlertTypeData latest count = 0"); } } catch (NullPointerException e) { Log.e(TAG, "Nullpointer exception in sendAlertTypeData: " + e); } }
Example 4
Source File: ListenerService.java From xDrip with GNU General Public License v3.0 | 6 votes |
public static DataMap getBloodTests(long startTime) { BloodTest last = BloodTest.last(); if (last != null) { Log.d(TAG, "getBloodTests last.timestamp:" + JoH.dateTimeText(last.timestamp)); } List<BloodTest> graph = BloodTest.latestForGraph(60, startTime); if (!graph.isEmpty()) { Log.d(TAG, "getBloodTests graph size=" + graph.size()); final ArrayList<DataMap> dataMaps = new ArrayList<>(graph.size()); DataMap entries = dataMapForWatchface(graph.get(0)); for (BloodTest data : graph) { dataMaps.add(dataMapForWatchface(data)); } entries.putDataMapArrayList("entries", dataMaps); Log.d(TAG, "getBloodTests entries=" + entries); return entries; } else { Log.d(TAG, "getBloodTests no entries for startTime=" + JoH.dateTimeText(startTime)); return null; } }
Example 5
Source File: DataManager.java From ibm-wearables-android-sdk with Apache License 2.0 | 6 votes |
/** * Create new Data Request and send it to the phone */ private void sendNextGestureData() { PutDataMapRequest dataMapRequest = getNewSensorsDataMapRequest(); DataMap dataMap = dataMapRequest.getDataMap(); List<GestureDataHolder.EventData> nextAccelerometerData = gestureDataHolder.pollNextAccelerometerData(); if (nextAccelerometerData.size() > 0){ dataMap.putDataMapArrayList("accelerometer", convertEventsToDataMapList(nextAccelerometerData)); } List<GestureDataHolder.EventData> nextGyroscopeData = gestureDataHolder.pollNextGyroscopeData(); if (nextGyroscopeData.size() > 0){ dataMap.putDataMapArrayList("gyroscope", convertEventsToDataMapList(nextGyroscopeData)); } dataSender.sendData(dataMapRequest); }
Example 6
Source File: WatchUpdaterService.java From xDrip with GNU General Public License v3.0 | 6 votes |
private void resendData(long since) { Log.d(TAG, "resendData ENTER"); forceGoogleApiConnect(); final long startTime = since == 0 ? new Date().getTime() - (60000 * 60 * 24) : since; Log.d(TAG, "resendData googleApiClient connected ENTER, sending since: " + JoH.dateTimeText(startTime)); final BgReading last_bg = BgReading.last(); if (last_bg != null) { List<BgReading> graph_bgs = BgReading.latestForGraph(60, startTime); BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(getApplicationContext()); if (!graph_bgs.isEmpty()) { final int battery = PowerStateReceiver.getBatteryLevel(getApplicationContext()); DataMap entries = dataMap(last_bg, mPrefs, bgGraphBuilder, battery); final ArrayList<DataMap> dataMaps = new ArrayList<>(graph_bgs.size()); for (BgReading bg : graph_bgs) { dataMaps.add(dataMap(bg, mPrefs, bgGraphBuilder, battery)); } entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putDataMapArrayList("entries", dataMaps); if (mPrefs.getBoolean("extra_status_line", false)) { entries.putString("extra_status_line", StatusLine.extraStatusLine()); } new SendToDataLayerThread(WEARABLE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, entries); } } }
Example 7
Source File: WatchUpdaterService.java From xDrip with GNU General Public License v3.0 | 6 votes |
private void sendAlertTypeData() {//KS try { forceGoogleApiConnect(); List<AlertType> alerts = AlertType.getAllActive(); if (alerts != null) { if (wear_integration) { Log.d(TAG, "sendAlertTypeData latest count = " + alerts.size()); final DataMap entries = new DataMap(); final ArrayList<DataMap> dataMaps = new ArrayList<>(alerts.size()); for (AlertType alert : alerts) { if (alert != null) { dataMaps.add(dataMap(alert, "alert")); } } entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putDataMapArrayList("entries", dataMaps); new SendToDataLayerThread(WEARABLE_ALERTTYPE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, entries); } else Log.d(TAG, "sendAlertTypeData latest count = 0"); } } catch (NullPointerException e) { Log.e(TAG, "Nullpointer exception in sendAlertTypeData: " + e); } }
Example 8
Source File: BgSendQueue.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static void resendData(Context context, int battery) {//KS Log.d("BgSendQueue", "resendData enter battery=" + battery); long startTime = new Date().getTime() - (60000 * 60 * 24); Intent messageIntent = new Intent(); messageIntent.setAction(Intent.ACTION_SEND); messageIntent.putExtra("message", "ACTION_G5BG"); BgReading last_bg = BgReading.last(); if (last_bg != null) { Log.d("BgSendQueue", "resendData last_bg.timestamp:" + JoH.dateTimeText(last_bg.timestamp)); } List<BgReading> graph_bgs = BgReading.latestForGraph(60, startTime); BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(context.getApplicationContext()); if (!graph_bgs.isEmpty()) { Log.d("BgSendQueue", "resendData graph_bgs size=" + graph_bgs.size()); final ArrayList<DataMap> dataMaps = new ArrayList<>(graph_bgs.size()); SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); DataMap entries = dataMap(last_bg, sharedPrefs, bgGraphBuilder, context, battery); for (BgReading bg : graph_bgs) { dataMaps.add(dataMap(bg, sharedPrefs, bgGraphBuilder, context, battery)); } entries.putDataMapArrayList("entries", dataMaps); if (sharedPrefs.getBoolean("extra_status_line", false)) { //messageIntent.putExtra("extra_status_line", extraStatusLine(sharedPrefs)); entries.putString("extra_status_line", extraStatusLine(sharedPrefs)); } Log.d("BgSendQueue", "resendData entries=" + entries); messageIntent.putExtra("data", entries.toBundle()); DataMap stepsDataMap = getSensorSteps(sharedPrefs); if (stepsDataMap != null) { messageIntent.putExtra("steps", stepsDataMap.toBundle()); } LocalBroadcastManager.getInstance(context).sendBroadcast(messageIntent); } }
Example 9
Source File: ListenerService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private synchronized DataMap getWearTreatmentsData(int count, long last_send_time, int min_count) { forceGoogleApiConnect(); Log.d(TAG, "getWearTreatmentsData last_send_time:" + JoH.dateTimeText(last_send_time) + " max count=" + count + " min_count=" + min_count); Treatments last_log = Treatments.lastSystime(); if (last_log != null) { Log.d(TAG, "getWearTreatmentsData last systimestamp: " + last_log.systimestamp + " " + JoH.dateTimeText((long) last_log.systimestamp)); } if (last_log != null && last_log.systimestamp > 0 && last_send_time <= last_log.systimestamp) {//startTime long last_send_success = last_send_time; Log.d(TAG, "getWearTreatmentsData last_send_time < last_log.timestamp:" + JoH.dateTimeText((long) last_log.systimestamp)); List<Treatments> logs = Treatments.latestForGraphSystime(count, last_send_time); if (!logs.isEmpty() && logs.size() > min_count) { //Log.d(TAG, "getWearLogData count = " + logs.size()); DataMap entries = dataMap(last_log); final ArrayList<DataMap> dataMaps = new ArrayList<>(logs.size()); for (Treatments log : logs) { dataMaps.add(dataMap(log)); last_send_success = (long)log.systimestamp; //Log.d(TAG, "getWearTreatmentsData set last_send_sucess:" + JoH.dateTimeText(last_send_sucess) + " Log:" + log.toString()); } entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putDataMapArrayList("entries", dataMaps); Log.i(TAG, "getWearTreatmentsData SYNCED treatments up to " + JoH.dateTimeText(last_send_success) + " count = " + logs.size()); return entries; } else Log.i(TAG, "getWearTreatmentsData SYNCED treatments up to " + JoH.dateTimeText(last_send_success) + " count = 0"); } return null; }
Example 10
Source File: ListenerService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private synchronized DataMap getWearStepSensorData(int count, long last_send_time, int min_count) {//final int sensorType, final int accuracy, final long timestamp, final float[] values) { forceGoogleApiConnect(); Log.d(TAG, "getWearStepSensorData last_send_time:" + JoH.dateTimeText(last_send_time)); PebbleMovement last_log = PebbleMovement.last(); if (last_log != null) { Log.d(TAG, "getWearStepSensorData last_log.timestamp:" + JoH.dateTimeText((long) last_log.timestamp)); } else { Log.d(TAG, "getWearStepSensorData PebbleMovement.last() = null:"); } if (last_log != null && last_send_time <= last_log.timestamp) {//startTime long last_send_success = last_send_time; Log.d(TAG, "getWearStepSensorData last_send_time < last_bg.timestamp:" + JoH.dateTimeText((long) last_log.timestamp)); List<PebbleMovement> logs = PebbleMovement.latestForGraph(count, last_send_time); if (!logs.isEmpty() && logs.size() > min_count) { //Log.d(TAG, "getWearStepSensorData count = " + logs.size()); DataMap entries = dataMap(last_log); final ArrayList<DataMap> dataMaps = new ArrayList<>(logs.size()); for (PebbleMovement log : logs) { dataMaps.add(dataMap(log)); last_send_success = (long)log.timestamp; //Log.d(TAG, "getWearStepSensorData set last_send_sucess:" + JoH.dateTimeText(last_send_success) + " pw.metric: " + log.metric + " pw.timestamp: " + JoH.dateTimeText(log.timestamp)); } entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putDataMapArrayList("entries", dataMaps); //Log.d(TAG, "getWearStepSensorData entries:" + entries); Log.i(TAG, "getWearStepSensorData SYNCED steps up to " + JoH.dateTimeText(last_send_success) + " count = " + logs.size()); return entries; } else Log.i(TAG, "getWearStepSensorData SYNCED steps up to " + JoH.dateTimeText(last_send_success) + " count = 0"); } return null; }
Example 11
Source File: ListenerService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private synchronized DataMap getWearLogData(int count, long last_send_time, int min_count, long syncLogsRequested) { forceGoogleApiConnect(); min_count = 0; // FORCE ALWAYS SEND // TODO revisit this Log.d(TAG, "getWearLogData last_send_time:" + JoH.dateTimeText(last_send_time) + " max count=" + count + " min_count=" + min_count + " syncLogsRequested=" + syncLogsRequested); UserError last_log = UserError.last(); if (last_log != null) { Log.d(TAG, "getWearLogData last_log.timestamp:" + JoH.dateTimeText((long) last_log.timestamp)); } if (last_log != null && last_send_time <= last_log.timestamp) {//startTime long last_send_success = last_send_time; Log.d(TAG, "getWearLogData last_send_time < last_bg.timestamp:" + JoH.dateTimeText((long) last_log.timestamp)); List<UserError> logs = UserError.latestAsc(count, last_send_time); if (!logs.isEmpty() && logs.size() > min_count) { //Log.d(TAG, "getWearLogData count = " + logs.size()); DataMap entries = dataMap(last_log); final ArrayList<DataMap> dataMaps = new ArrayList<>(logs.size()); for (UserError log : logs) { dataMaps.add(dataMap(log)); last_send_success = (long)log.timestamp; //Log.d(TAG, "getWearLogData set last_send_sucess:" + JoH.dateTimeText(last_send_sucess) + " Log:" + log.toString()); } entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putLong("syncLogsRequested", syncLogsRequested); entries.putDataMapArrayList("entries", dataMaps); Log.i(TAG, "getWearLogData SYNCED logs up to " + JoH.dateTimeText(last_send_success) + " count = " + logs.size() + " syncLogsRequested=" + syncLogsRequested); return entries; } else Log.i(TAG, "getWearLogData SYNCED logs up to " + JoH.dateTimeText(last_send_success) + " count = 0" + " syncLogsRequested=" + syncLogsRequested); } return null; }
Example 12
Source File: WatchUpdaterService.java From AndroidAPS with GNU Affero General Public License v3.0 | 5 votes |
private void resendData() { if (googleApiClient != null && !googleApiClient.isConnected() && !googleApiClient.isConnecting()) { googleApiConnect(); } long startTime = System.currentTimeMillis() - (long) (60000 * 60 * 5.5); BgReading last_bg = DatabaseHelper.lastBg(); if (last_bg == null) return; List<BgReading> graph_bgs = MainApp.getDbHelper().getBgreadingsDataFromTime(startTime, true); GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData(true); if (!graph_bgs.isEmpty()) { DataMap entries = dataMapSingleBG(last_bg, glucoseStatus); if (entries == null) { ToastUtils.showToastInUiThread(this, MainApp.gs(R.string.noprofile)); return; } final ArrayList<DataMap> dataMaps = new ArrayList<>(graph_bgs.size()); for (BgReading bg : graph_bgs) { DataMap dataMap = dataMapSingleBG(bg, glucoseStatus); if (dataMap != null) { dataMaps.add(dataMap); } } entries.putDataMapArrayList("entries", dataMaps); executeTask(new SendToDataLayerThread(WEARABLE_DATA_PATH, googleApiClient), entries); } sendPreferences(); sendBasals(); sendStatus(); }
Example 13
Source File: ListenerService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private synchronized DataMap getWearBgReadingData(int count, long last_send_time, int min_count) { forceGoogleApiConnect(); Log.d(TAG, "getWearBgReadingData last_send_time:" + JoH.dateTimeText(last_send_time)); BgReading last_bg = BgReading.last(); if (last_bg != null) { Log.d(TAG, "getWearBgReadingData last_bg.timestamp:" + JoH.dateTimeText(last_bg.timestamp)); } if (last_bg != null && last_send_time <= last_bg.timestamp) {//startTime long last_send_success = last_send_time; Log.d(TAG, "getWearBgData last_send_time < last_bg.timestamp:" + JoH.dateTimeText(last_bg.timestamp)); final List<BgReading> graph_bgs = BgReading.latestForGraphAsc(count, last_send_time); if (!graph_bgs.isEmpty() && graph_bgs.size() > min_count) { //Log.d(TAG, "getWearBgData count = " + graph_bgs.size()); final DataMap entries = dataMap(last_bg); final ArrayList<DataMap> dataMaps = new ArrayList<>(graph_bgs.size()); for (BgReading bg : graph_bgs) { dataMaps.add(dataMap(bg)); last_send_success = bg.timestamp; //Log.d(TAG, "getWearBgData bg getId:" + bg.getId() + " raw_data:" + bg.raw_data + " filtered_data:" + bg.filtered_data + " timestamp:" + bg.timestamp + " uuid:" + bg.uuid); } entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putDataMapArrayList("entries", dataMaps); Log.i(TAG, "getWearBgReadingData SYNCED BGs up to " + JoH.dateTimeText(last_send_success) + " count = " + graph_bgs.size()); return entries; } else Log.i(TAG, "getWearBgReading SYNCED BGs up to " + JoH.dateTimeText(last_send_success) + " count = 0"); } return null; }
Example 14
Source File: HeartRateService.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static synchronized DataMap getWearHeartSensorData(int count, long last_send_time, int min_count) { UserError.Log.d(TAG, "getWearHeartSensorData last_send_time:" + JoH.dateTimeText(last_send_time)); if ((count != 0) || (JoH.ratelimit("heartrate-datamap", 5))) { HeartRate last_log = HeartRate.last(); if (last_log != null) { UserError.Log.d(TAG, "getWearHeartSensorData last_log.timestamp:" + JoH.dateTimeText((long) last_log.timestamp)); } else { UserError.Log.d(TAG, "getWearHeartSensorData HeartRate.last() = null:"); return null; } if (last_log != null && last_send_time <= last_log.timestamp) {//startTime long last_send_success = last_send_time; UserError.Log.d(TAG, "getWearHeartSensorData last_send_time < last_bg.timestamp:" + JoH.dateTimeText((long) last_log.timestamp)); List<HeartRate> logs = HeartRate.latestForGraph(count, last_send_time); if (!logs.isEmpty() && logs.size() > min_count) { DataMap entries = dataMap(last_log); final ArrayList<DataMap> dataMaps = new ArrayList<>(logs.size()); for (HeartRate log : logs) { dataMaps.add(dataMap(log)); last_send_success = (long) log.timestamp; } entries.putLong("time", JoH.tsl()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putDataMapArrayList("entries", dataMaps); UserError.Log.i(TAG, "getWearHeartSensorData SYNCED up to " + JoH.dateTimeText(last_send_success) + " count = " + logs.size()); return entries; } else UserError.Log.i(TAG, "getWearHeartSensorData SYNCED up to " + JoH.dateTimeText(last_send_success) + " count = 0"); } return null; } else { UserError.Log.d(TAG, "Ratelimitted getWearHeartSensorData"); return null; } }
Example 15
Source File: BgSendQueue.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static void resendData(Context context, int battery) {//KS Log.d("BgSendQueue", "resendData enter battery=" + battery); long startTime = new Date().getTime() - (60000 * 60 * 24); Intent messageIntent = new Intent(); messageIntent.setAction(Intent.ACTION_SEND); messageIntent.putExtra("message", "ACTION_G5BG"); BgReading last_bg = BgReading.last(); if (last_bg != null) { Log.d("BgSendQueue", "resendData last_bg.timestamp:" + JoH.dateTimeText(last_bg.timestamp)); } List<BgReading> graph_bgs = BgReading.latestForGraph(60, startTime); BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(context.getApplicationContext()); if (!graph_bgs.isEmpty()) { Log.d("BgSendQueue", "resendData graph_bgs size=" + graph_bgs.size()); final ArrayList<DataMap> dataMaps = new ArrayList<>(graph_bgs.size()); SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); DataMap entries = dataMap(last_bg, sharedPrefs, bgGraphBuilder, context, battery); for (BgReading bg : graph_bgs) { dataMaps.add(dataMap(bg, sharedPrefs, bgGraphBuilder, context, battery)); } entries.putDataMapArrayList("entries", dataMaps); if (sharedPrefs.getBoolean("extra_status_line", false)) { //messageIntent.putExtra("extra_status_line", extraStatusLine(sharedPrefs)); entries.putString("extra_status_line", extraStatusLine(sharedPrefs)); } Log.d("BgSendQueue", "resendData entries=" + entries); messageIntent.putExtra("data", entries.toBundle()); DataMap stepsDataMap = getSensorSteps(sharedPrefs); if (stepsDataMap != null) { messageIntent.putExtra("steps", stepsDataMap.toBundle()); } LocalBroadcastManager.getInstance(context).sendBroadcast(messageIntent); } }
Example 16
Source File: ListenerService.java From xDrip with GNU General Public License v3.0 | 5 votes |
private synchronized DataMap getWearStepSensorData(int count, long last_send_time, int min_count) {//final int sensorType, final int accuracy, final long timestamp, final float[] values) { forceGoogleApiConnect(); Log.d(TAG, "getWearStepSensorData last_send_time:" + JoH.dateTimeText(last_send_time)); PebbleMovement last_log = PebbleMovement.last(); if (last_log != null) { Log.d(TAG, "getWearStepSensorData last_log.timestamp:" + JoH.dateTimeText((long) last_log.timestamp)); } else { Log.d(TAG, "getWearStepSensorData PebbleMovement.last() = null:"); } if (last_log != null && last_send_time <= last_log.timestamp) {//startTime long last_send_success = last_send_time; Log.d(TAG, "getWearStepSensorData last_send_time < last_bg.timestamp:" + JoH.dateTimeText((long) last_log.timestamp)); List<PebbleMovement> logs = PebbleMovement.latestForGraph(count, last_send_time); if (!logs.isEmpty() && logs.size() > min_count) { //Log.d(TAG, "getWearStepSensorData count = " + logs.size()); DataMap entries = dataMap(last_log); final ArrayList<DataMap> dataMaps = new ArrayList<>(logs.size()); for (PebbleMovement log : logs) { dataMaps.add(dataMap(log)); last_send_success = (long)log.timestamp; //Log.d(TAG, "getWearStepSensorData set last_send_sucess:" + JoH.dateTimeText(last_send_success) + " pw.metric: " + log.metric + " pw.timestamp: " + JoH.dateTimeText(log.timestamp)); } entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putDataMapArrayList("entries", dataMaps); //Log.d(TAG, "getWearStepSensorData entries:" + entries); Log.i(TAG, "getWearStepSensorData SYNCED steps up to " + JoH.dateTimeText(last_send_success) + " count = " + logs.size()); return entries; } else Log.i(TAG, "getWearStepSensorData SYNCED steps up to " + JoH.dateTimeText(last_send_success) + " count = 0"); } return null; }
Example 17
Source File: ListenerService.java From xDrip with GNU General Public License v3.0 | 5 votes |
private synchronized DataMap getWearTransmitterData(int count, long last_send_time, int min_count) {//KS forceGoogleApiConnect(); Log.d(TAG, "getWearTransmitterData last_send_time:" + JoH.dateTimeText(last_send_time)); TransmitterData last_bg = TransmitterData.last(); if (last_bg != null) { Log.d(TAG, "getWearTransmitterData last_bg.timestamp:" + JoH.dateTimeText(last_bg.timestamp)); } if (last_bg != null && last_send_time <= last_bg.timestamp) {//startTime long last_send_success = last_send_time; Log.d(TAG, "getWearTransmitterData last_send_time < last_bg.timestamp:" + JoH.dateTimeText(last_bg.timestamp)); List<TransmitterData> graph_bgs = TransmitterData.latestForGraphAsc(count, last_send_time); if (!graph_bgs.isEmpty() && graph_bgs.size() > min_count) { //Log.d(TAG, "getWearTransmitterData count = " + graph_bgs.size()); DataMap entries = dataMap(last_bg); final ArrayList<DataMap> dataMaps = new ArrayList<>(graph_bgs.size()); for (TransmitterData bg : graph_bgs) { dataMaps.add(dataMap(bg)); last_send_success = bg.timestamp; //Log.d(TAG, "getWearTransmitterData bg getId:" + bg.getId() + " raw_data:" + bg.raw_data + " filtered_data:" + bg.filtered_data + " timestamp:" + bg.timestamp + " uuid:" + bg.uuid); } entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putDataMapArrayList("entries", dataMaps); Log.i(TAG, "getWearTransmitterData SYNCED BGs up to " + JoH.dateTimeText(last_send_success) + " count = " + graph_bgs.size()); return entries; } else Log.i(TAG, "getWearTransmitterData SYNCED BGs up to " + JoH.dateTimeText(last_send_success) + " count = 0"); } return null; }
Example 18
Source File: ListenerService.java From xDrip with GNU General Public License v3.0 | 5 votes |
private synchronized DataMap getWearBgReadingData(int count, long last_send_time, int min_count) { forceGoogleApiConnect(); Log.d(TAG, "getWearBgReadingData last_send_time:" + JoH.dateTimeText(last_send_time)); BgReading last_bg = BgReading.last(); if (last_bg != null) { Log.d(TAG, "getWearBgReadingData last_bg.timestamp:" + JoH.dateTimeText(last_bg.timestamp)); } if (last_bg != null && last_send_time <= last_bg.timestamp) {//startTime long last_send_success = last_send_time; Log.d(TAG, "getWearBgData last_send_time < last_bg.timestamp:" + JoH.dateTimeText(last_bg.timestamp)); final List<BgReading> graph_bgs = BgReading.latestForGraphAsc(count, last_send_time); if (!graph_bgs.isEmpty() && graph_bgs.size() > min_count) { //Log.d(TAG, "getWearBgData count = " + graph_bgs.size()); final DataMap entries = dataMap(last_bg); final ArrayList<DataMap> dataMaps = new ArrayList<>(graph_bgs.size()); for (BgReading bg : graph_bgs) { dataMaps.add(dataMap(bg)); last_send_success = bg.timestamp; //Log.d(TAG, "getWearBgData bg getId:" + bg.getId() + " raw_data:" + bg.raw_data + " filtered_data:" + bg.filtered_data + " timestamp:" + bg.timestamp + " uuid:" + bg.uuid); } entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP entries.putDataMapArrayList("entries", dataMaps); Log.i(TAG, "getWearBgReadingData SYNCED BGs up to " + JoH.dateTimeText(last_send_success) + " count = " + graph_bgs.size()); return entries; } else Log.i(TAG, "getWearBgReading SYNCED BGs up to " + JoH.dateTimeText(last_send_success) + " count = 0"); } return null; }
Example 19
Source File: RawDisplayDataBasalsTest.java From AndroidAPS with GNU Affero General Public License v3.0 | 4 votes |
private DataMap dataMapForBasals() { DataMap dataMap = new DataMap(); ArrayList<DataMap> temps = new ArrayList<>(); DataMap temp = new DataMap(); temp.putLong("starttime", WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*20); temp.putDouble("startBasal", 1.5); temp.putLong("endtime", WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*10); temp.putDouble("endbasal", 1.5); temp.putDouble("amount", 1.8); temps.add(temp); DataMap temp2 = new DataMap(); temp2.putLong("starttime", WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*10); temp2.putDouble("startBasal", 1.3); temp2.putLong("endtime", WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*2); temp2.putDouble("endbasal", 1.3); temp2.putDouble("amount", 2.3); temps.add(temp2); dataMap.putDataMapArrayList("temps", temps); ArrayList<DataMap> basals = new ArrayList<>(); DataMap basal = new DataMap(); basal.putLong("starttime", WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*20); basal.putLong("endtime", WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*2); basal.putDouble("amount", 1.2); basals.add(basal); dataMap.putDataMapArrayList("basals", basals); ArrayList<DataMap> boluses = new ArrayList<>(); DataMap bolus = new DataMap(); bolus.putLong("date", WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*17); bolus.putDouble("bolus", 5.5); bolus.putDouble("carbs", 20.0); bolus.putBoolean("isSMB", false); bolus.putBoolean("isValid", true); boluses.add(bolus); DataMap bolus2 = new DataMap(); bolus2.putLong("date", WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*11); bolus2.putDouble("bolus", 3.0); bolus2.putDouble("carbs", 0.0); bolus2.putBoolean("isSMB", false); bolus2.putBoolean("isValid", true); boluses.add(bolus2); DataMap bolus3 = new DataMap(); bolus3.putLong("date", WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*3); bolus3.putDouble("bolus", 0.0); bolus3.putDouble("carbs", 15.0); bolus3.putBoolean("isSMB", true); bolus3.putBoolean("isValid", false); boluses.add(bolus3); dataMap.putDataMapArrayList("boluses", boluses); ArrayList<DataMap> predictions = new ArrayList<>(); for (int i=0; i<10; i++) { DataMap prediction = new DataMap(); prediction.putLong("timestamp", WearUtilMocker.REF_NOW + Constants.MINUTE_IN_MS*i); prediction.putDouble("sgv", 160-4*i); prediction.putInt("color", 0); predictions.add(prediction); } dataMap.putDataMapArrayList("predictions", predictions); return dataMap; }
Example 20
Source File: DataBundleUtil.java From android_external_GmsLib with Apache License 2.0 | 4 votes |
@Override void storeList(DataMap dataMap, String key, ArrayList<DataMap> valueList) { dataMap.putDataMapArrayList(key, valueList); }