private void sendG5QueueData(String queueData) { if ((wear_integration) && (queueData != null)) { forceGoogleApiConnect(); new SendToDataLayerThread(WEARABLE_G5_QUEUE_PATH, googleApiClient).executeOnExecutor(xdrip.executor, dataMap("queueData", queueData)); } }
private void sendG5QueueData(String queueData) { if ((wear_integration) && (queueData != null)) { forceGoogleApiConnect(); new SendToDataLayerThread(WEARABLE_G5_QUEUE_PATH, googleApiClient).executeOnExecutor(xdrip.executor, dataMap("queueData", queueData)); } }
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); } }
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); } }
private void sendActiveBtDeviceData() {//KS if (is_using_bt) {//only required for Collector running on watch forceGoogleApiConnect(); ActiveBluetoothDevice btDevice = ActiveBluetoothDevice.first(); if (btDevice != null) { if (wear_integration) { DataMap dataMap = new DataMap(); Log.d(TAG, "sendActiveBtDeviceData name=" + btDevice.name + " address=" + btDevice.address + " connected=" + btDevice.connected); dataMap.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP dataMap.putString("name", btDevice.name); dataMap.putString("address", btDevice.address); dataMap.putBoolean("connected", btDevice.connected); new SendToDataLayerThread(WEARABLE_ACTIVEBTDEVICE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, dataMap); } } } else { Log.d(TAG, "Not sending activebluetoothdevice data as we are not using bt"); } }
private void sendActiveBtDeviceData() {//KS if (is_using_bt) {//only required for Collector running on watch forceGoogleApiConnect(); ActiveBluetoothDevice btDevice = ActiveBluetoothDevice.first(); if (btDevice != null) { if (wear_integration) { DataMap dataMap = new DataMap(); Log.d(TAG, "sendActiveBtDeviceData name=" + btDevice.name + " address=" + btDevice.address + " connected=" + btDevice.connected); dataMap.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP dataMap.putString("name", btDevice.name); dataMap.putString("address", btDevice.address); dataMap.putBoolean("connected", btDevice.connected); new SendToDataLayerThread(WEARABLE_ACTIVEBTDEVICE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, dataMap); } } } else { Log.d(TAG, "Not sending activebluetoothdevice data as we are not using bt"); } }
private void sendRequestExtra(String path, String key, boolean value) { forceGoogleApiConnect(); if (googleApiClient.isConnected()) { PutDataMapRequest dataMapRequest = PutDataMapRequest.create(path);//NEW_STATUS_PATH //unique content dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis()); dataMapRequest.getDataMap().putBoolean(key, value);//"externalStatusString" PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest(); Wearable.DataApi.putDataItem(googleApiClient, putDataRequest); } else { Log.e("sendRequestExtra", "No connection to wearable available!"); } }
private void sendRequestExtra(String path, String key, byte[] value) { forceGoogleApiConnect(); if (googleApiClient.isConnected()) { PutDataMapRequest dataMapRequest = PutDataMapRequest.create(path); dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis()); dataMapRequest.getDataMap().putByteArray(key, value); PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest(); dataMapRequest.setUrgent(); Wearable.DataApi.putDataItem(googleApiClient, putDataRequest); Log.d(TAG, "Sending bytes path: " + path + " " + value.length); } else { Log.e("sendRequestExtra", "No connection to wearable available!"); } }
private void sendRequestExtra(String path, String key, boolean value) { forceGoogleApiConnect(); if (googleApiClient.isConnected()) { PutDataMapRequest dataMapRequest = PutDataMapRequest.create(path);//NEW_STATUS_PATH //unique content dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis()); dataMapRequest.getDataMap().putBoolean(key, value);//"externalStatusString" PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest(); Wearable.DataApi.putDataItem(googleApiClient, putDataRequest); } else { Log.e("sendRequestExtra", "No connection to wearable available!"); } }
private void sendRequestExtra(String path, String key, byte[] value) { forceGoogleApiConnect(); if (googleApiClient.isConnected()) { PutDataMapRequest dataMapRequest = PutDataMapRequest.create(path); dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis()); dataMapRequest.getDataMap().putByteArray(key, value); PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest(); dataMapRequest.setUrgent(); Wearable.DataApi.putDataItem(googleApiClient, putDataRequest); Log.d(TAG, "Sending bytes path: " + path + " " + value.length); } else { Log.e("sendRequestExtra", "No connection to wearable available!"); } }
private void sendRequestExtra(String path, String key, String value) { forceGoogleApiConnect(); if (googleApiClient.isConnected()) { PutDataMapRequest dataMapRequest = PutDataMapRequest.create(path);//NEW_STATUS_PATH //unique content dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis()); dataMapRequest.getDataMap().putString(key, value);//"externalStatusString" PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest(); Wearable.DataApi.putDataItem(googleApiClient, putDataRequest); } else { Log.e("sendRequestExtra", "No connection to wearable available!"); } }
private void sendNotification(String path, String notification) {//KS add args forceGoogleApiConnect(); if (googleApiClient.isConnected()) { Log.d(TAG, "sendNotification Notification=" + notification + " Path=" + path); PutDataMapRequest dataMapRequest = PutDataMapRequest.create(path); //unique content dataMapRequest.setUrgent(); dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis()); dataMapRequest.getDataMap().putString(notification, notification); PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest(); Wearable.DataApi.putDataItem(googleApiClient, putDataRequest); } else { Log.e(TAG, "sendNotification No connection to wearable available!"); } }
private void sendRequestExtra(String path, String key, String value) { forceGoogleApiConnect(); if (googleApiClient.isConnected()) { PutDataMapRequest dataMapRequest = PutDataMapRequest.create(path);//NEW_STATUS_PATH //unique content dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis()); dataMapRequest.getDataMap().putString(key, value);//"externalStatusString" PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest(); Wearable.DataApi.putDataItem(googleApiClient, putDataRequest); } else { Log.e("sendRequestExtra", "No connection to wearable available!"); } }
private void sendNotification(String path, String notification) {//KS add args forceGoogleApiConnect(); if (googleApiClient.isConnected()) { Log.d(TAG, "sendNotification Notification=" + notification + " Path=" + path); PutDataMapRequest dataMapRequest = PutDataMapRequest.create(path); //unique content dataMapRequest.setUrgent(); dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis()); dataMapRequest.getDataMap().putString(notification, notification); PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest(); Wearable.DataApi.putDataItem(googleApiClient, putDataRequest); } else { Log.e(TAG, "sendNotification No connection to wearable available!"); } }
private void setLocalNodeName() { forceGoogleApiConnect(); NodeApi.GetLocalNodeResult localnodes = Wearable.NodeApi.getLocalNode(googleApiClient).await(60, TimeUnit.SECONDS); Node getnode = localnodes.getNode(); localnode = getnode != null ? getnode.getDisplayName() + "|" + getnode.getId() : ""; UserError.Log.d(TAG, "setLocalNodeName. localnode=" + localnode); }
private void setLocalNodeName() { forceGoogleApiConnect(); NodeApi.GetLocalNodeResult localnodes = Wearable.NodeApi.getLocalNode(googleApiClient).await(60, TimeUnit.SECONDS); Node getnode = localnodes.getNode(); localnode = getnode != null ? getnode.getDisplayName() + "|" + getnode.getId() : ""; UserError.Log.d(TAG, "setLocalNodeName. localnode=" + localnode); }
private void sendData() { BgReading bg = BgReading.last(); if (bg != null) { forceGoogleApiConnect(); if (wear_integration) { final int battery = PowerStateReceiver.getBatteryLevel(getApplicationContext()); new SendToDataLayerThread(WEARABLE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, dataMap(bg, mPrefs, new BgGraphBuilder(getApplicationContext()), battery)); } } }
private void sendData() { BgReading bg = BgReading.last(); if (bg != null) { forceGoogleApiConnect(); if (wear_integration) { final int battery = PowerStateReceiver.getBatteryLevel(getApplicationContext()); new SendToDataLayerThread(WEARABLE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, dataMap(bg, mPrefs, new BgGraphBuilder(getApplicationContext()), battery)); } } }
private void sendDataReceived(String path, String notification, long timeOfLastEntry, String type, long watch_syncLogsRequested) {//KS Log.d(TAG, "sendDataReceived timeOfLastEntry=" + JoH.dateTimeText(timeOfLastEntry) + " Path=" + path); forceGoogleApiConnect(); if (googleApiClient.isConnected()) { PutDataMapRequest dataMapRequest = PutDataMapRequest.create(path); dataMapRequest.setUrgent(); dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis()); dataMapRequest.getDataMap().putLong("timeOfLastEntry", timeOfLastEntry); dataMapRequest.getDataMap().putLong("syncLogsRequested", watch_syncLogsRequested); dataMapRequest.getDataMap().putString("type", type); dataMapRequest.getDataMap().putString("msg", notification); PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest(); Wearable.DataApi.putDataItem(googleApiClient, putDataRequest); } else { Log.e(TAG, "sendDataReceived No connection to wearable available!"); } }
private void sendDataReceived(String path, String notification, long timeOfLastEntry, String type, long watch_syncLogsRequested) {//KS Log.d(TAG, "sendDataReceived timeOfLastEntry=" + JoH.dateTimeText(timeOfLastEntry) + " Path=" + path); forceGoogleApiConnect(); if (googleApiClient.isConnected()) { PutDataMapRequest dataMapRequest = PutDataMapRequest.create(path); dataMapRequest.setUrgent(); dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis()); dataMapRequest.getDataMap().putLong("timeOfLastEntry", timeOfLastEntry); dataMapRequest.getDataMap().putLong("syncLogsRequested", watch_syncLogsRequested); dataMapRequest.getDataMap().putString("type", type); dataMapRequest.getDataMap().putString("msg", notification); PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest(); Wearable.DataApi.putDataItem(googleApiClient, putDataRequest); } else { Log.e(TAG, "sendDataReceived No connection to wearable available!"); } }