com.eveningoutpost.dexdrip.Models.UserError.Log Java Examples
The following examples show how to use
com.eveningoutpost.dexdrip.Models.UserError.Log.
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: 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 #2
Source File: AlertType.java From xDrip-Experimental with GNU General Public License v3.0 | 6 votes |
public static boolean toSettings(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); List<AlertType> alerts = new Select() .from(AlertType.class) .execute(); Gson gson = new GsonBuilder() .excludeFieldsWithoutExposeAnnotation() .registerTypeAdapter(Date.class, new DateTypeAdapter()) .serializeSpecialFloatingPointValues() .create(); String output = gson.toJson(alerts); Log.e(TAG, "Created the string " + output); prefs.edit().putString("saved_alerts", output).commit(); return true; }
Example #3
Source File: DexShareCollectionService.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private void gattWritingStep() { Log.d(TAG, "Writing command to the Gatt, step: " + step); int index = step; if (index <= (writePackets.size() - 1)) { Log.d(TAG, "Writing: " + writePackets.get(index) + " index: " + index); if(mSendDataCharacteristic != null && writePackets != null) { mSendDataCharacteristic.setValue(writePackets.get(index)); if (mBluetoothGatt != null && mBluetoothGatt.writeCharacteristic(mSendDataCharacteristic)) { Log.d(TAG, "Wrote Successfully"); } } } else { Log.d(TAG, "Done Writing commands"); clearGattTask(); } }
Example #4
Source File: LibreAlarmReceiver.java From xDrip with GNU General Public License v3.0 | 6 votes |
public static void processReadingDataTransferObject(ReadingData.TransferObject object, long CaptureDateTime, String tagid, boolean allowUpload, byte []patchUid, byte []patchInfo) { Log.i(TAG, "Data that was recieved from librealarm is " + HexDump.dumpHexString(object.data.raw_data)); // Save raw block record (we start from block 0) LibreBlock.createAndSave(tagid, CaptureDateTime, object.data.raw_data, 0, allowUpload, patchUid, patchInfo); if(Pref.getBooleanDefaultFalse("external_blukon_algorithm")) { if(object.data.raw_data == null) { Log.e(TAG, "Please update LibreAlarm to use OOP algorithm"); JoH.static_toast_long(gs(R.string.please_update_librealarm_to_use_oop_algorithm)); return; } LibreOOPAlgorithm.SendData(object.data.raw_data, CaptureDateTime); return; } CalculateFromDataTransferObject(object, use_raw_); }
Example #5
Source File: DexCollectionService.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private void closeCycle(boolean should_close) { if (mBluetoothGatt != null) { try { if (JoH.ratelimit("refresh-gatt", 60)) { Log.d(TAG, "Refresh result close: " + JoH.refreshDeviceCache(TAG, mBluetoothGatt)); } if (should_close) { Log.i(TAG, "connect: mBluetoothGatt isn't null, Closing."); mBluetoothGatt.close(); } else { Log.i(TAG, "preserving existing connection"); } } catch (NullPointerException e) { Log.wtf(TAG, "Concurrency related null pointer in connect"); } finally { if (should_close) mBluetoothGatt = null; } } }
Example #6
Source File: Treatments.java From xDrip with GNU General Public License v3.0 | 6 votes |
private static Pair<Double, Double> calculateIobActivityFromTreatmentAtTime(final Treatments treatment, final double time, final boolean useBasal) { double iobContrib = 0, activityContrib = 0; if (treatment.insulin > 0) { // Log.d(TAG,"NEW TYPE insulin: "+treatment.insulin+ " "+treatment.insulinJSON); // translate a legacy entry to be bolus insulin List<InsulinInjection> injectionsList = treatment.getInsulinInjections(); if (injectionsList == null || injectionsList.size() == 0) { Log.d(TAG,"CONVERTING LEGACY: "+treatment.insulinJSON+ " "+injectionsList); injectionsList = convertLegacyDoseToBolusInjectionList(treatment.insulin); treatment.insulinInjections = injectionsList; // cache but best not to save it } for (final InsulinInjection injection : injectionsList) if (injection.getUnits() > 0 && (useBasal || !injection.isBasal())) { iobContrib += injection.getUnits() * abs(injection.getProfile().calculateIOB((time - treatment.timestamp) / MINUTE_IN_MS)); activityContrib += injection.getUnits() * abs(injection.getProfile().calculateActivity((time - treatment.timestamp) / MINUTE_IN_MS)); } if (iobContrib < 0) iobContrib = 0; if (activityContrib < 0) activityContrib = 0; } return new Pair<>(iobContrib, activityContrib); }
Example #7
Source File: Notifications.java From xDrip with GNU General Public License v3.0 | 6 votes |
@Override protected void onHandleIntent(Intent intent) { final PowerManager.WakeLock wl = JoH.getWakeLock("NotificationsService", 60000); boolean unclearReading; try { Log.d("Notifications", "Running Notifications Intent Service"); final Context context = getApplicationContext(); if (Pref.getBoolean("motion_tracking_enabled", false)) { // TODO move this ActivityRecognizedService.reStartActivityRecogniser(context); } ReadPerfs(context); unclearReading = notificationSetter(context); scheduleWakeup(context, unclearReading); context.startService(new Intent(context, MissedReadingService.class)); } finally { JoH.releaseWakeLock(wl); } }
Example #8
Source File: BaseWatchFace.java From xDrip with GNU General Public License v3.0 | 6 votes |
private void displayCard() { int cardWidth = mCardRect.width(); int cardHeight = mCardRect.height(); if (d) Log.d(TAG, "displayCard WatchFace.onCardPeek: getWidth()=" + getWidth() + " getHeight()=" + getHeight() + " cardWidth=" + cardWidth + " cardHeight=" + cardHeight); if (cardHeight > 0 && cardWidth > 0) { if (getCurrentWatchMode() != WatchMode.INTERACTIVE) { // get height of visible area (not including card) int visibleWidth = getWidth() - cardWidth; int visibleHeight = getHeight() - cardHeight; if (d) Log.d(TAG, "onCardPeek WatchFace.onCardPeek: visibleWidth=" + visibleWidth + " visibleHeight=" + visibleHeight); mRelativeLayout.layout(0, 0, visibleWidth, visibleHeight); } else resetRelativeLayout(); } else resetRelativeLayout(); invalidate(); }
Example #9
Source File: SyncingService.java From xDrip with GNU General Public License v3.0 | 6 votes |
private void broadcastSGVToUI(EGVRecord egvRecord, boolean uploadStatus, long nextUploadTime, long displayTime, JSONArray json, int batLvl) { Log.d(TAG, "Current EGV: " + egvRecord.getBGValue()); Intent broadcastIntent = new Intent(); // broadcastIntent.setAction(MainActivity.CGMStatusReceiver.PROCESS_RESPONSE); broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT); broadcastIntent.putExtra(RESPONSE_SGV, egvRecord.getBGValue()); broadcastIntent.putExtra(RESPONSE_TREND, egvRecord.getTrend().getID()); broadcastIntent.putExtra(RESPONSE_TIMESTAMP, egvRecord.getDisplayTime().getTime()); broadcastIntent.putExtra(RESPONSE_NEXT_UPLOAD_TIME, nextUploadTime); broadcastIntent.putExtra(RESPONSE_UPLOAD_STATUS, uploadStatus); broadcastIntent.putExtra(RESPONSE_DISPLAY_TIME, displayTime); if (json!=null) broadcastIntent.putExtra(RESPONSE_JSON, json.toString()); broadcastIntent.putExtra(RESPONSE_BAT, batLvl); sendBroadcast(broadcastIntent); }
Example #10
Source File: DexCollectionService.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private synchronized void processNewTransmitterData(TransmitterData transmitterData, long timestamp) { if (transmitterData == null) { return; } final Sensor sensor = Sensor.currentSensor(); if (sensor == null) { Log.i(TAG, "setSerialDataToTransmitterRawData: No Active Sensor, Data only stored in Transmitter Data"); return; } if (use_transmiter_pl_bluetooth && (transmitterData.raw_data == 100000)) { Log.wtf(TAG, "Ignoring probably erroneous Transmiter_PL data: " + transmitterData.raw_data); return; } //sensor.latest_battery_level = (sensor.latest_battery_level != 0) ? Math.min(sensor.latest_battery_level, transmitterData.sensor_battery_level) : transmitterData.sensor_battery_level; sensor.latest_battery_level = transmitterData.sensor_battery_level; // allow level to go up and down sensor.save(); last_transmitter_Data = transmitterData; Log.d(TAG, "BgReading.create: new BG reading at " + timestamp + " with a timestamp of " + transmitterData.timestamp); BgReading.create(transmitterData.raw_data, transmitterData.filtered_data, this, transmitterData.timestamp); }
Example #11
Source File: AlertType.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
static public boolean s_in_time_frame(boolean s_all_day, int s_start_time_minutes, int s_end_time_minutes) { if (s_all_day) { //Log.e(TAG, "in_time_frame returning true " ); return true; } // time_now is the number of minutes that have passed from the start of the day. Calendar rightNow = Calendar.getInstance(); int time_now = toTime(rightNow.get(Calendar.HOUR_OF_DAY), rightNow.get(Calendar.MINUTE)); Log.d(TAG, "time_now is " + time_now + " minutes" + " start_time " + s_start_time_minutes + " end_time " + s_end_time_minutes); if(s_start_time_minutes < s_end_time_minutes) { if (time_now >= s_start_time_minutes && time_now <= s_end_time_minutes) { return true; } } else { if (time_now >= s_start_time_minutes || time_now <= s_end_time_minutes) { return true; } } return false; }
Example #12
Source File: TransmitterData.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
public static TransmitterData getForTimestamp(double timestamp) {//KS try { Sensor sensor = Sensor.currentSensor(); if (sensor != null) { TransmitterData bgReading = new Select() .from(TransmitterData.class) .where("timestamp <= ?", (timestamp + (60 * 1000))) // 1 minute padding (should never be that far off, but why not) .orderBy("timestamp desc") .executeSingle(); if (bgReading != null && Math.abs(bgReading.timestamp - timestamp) < (3 * 60 * 1000)) { //cool, so was it actually within 4 minutes of that bg reading? Log.i(TAG, "getForTimestamp: Found a BG timestamp match"); return bgReading; } } } catch (Exception e) { Log.e(TAG,"getForTimestamp() Got exception on Select : "+e.toString()); return null; } Log.d(TAG, "getForTimestamp: No luck finding a BG timestamp match"); return null; }
Example #13
Source File: xDripWidget.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.x_drip_widget); Log.d(TAG, "Update widget signal received"); //Add behaviour: open xDrip on click Intent intent = new Intent(context, Home.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); views.setOnClickPendingIntent(R.id.xDripwidget, pendingIntent); displayCurrentInfo(appWidgetManager, appWidgetId, context, views); try { appWidgetManager.updateAppWidget(appWidgetId, views); // needed to catch RuntimeException and DeadObjectException } catch (Exception e) { Log.e(TAG, "Got Rexception in widget update: " + e); } }
Example #14
Source File: SyncingService.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private void broadcastSGVToUI(EGVRecord egvRecord, boolean uploadStatus, long nextUploadTime, long displayTime, JSONArray json, int batLvl) { Log.d(TAG, "Current EGV: " + egvRecord.getBGValue()); Intent broadcastIntent = new Intent(); // broadcastIntent.setAction(MainActivity.CGMStatusReceiver.PROCESS_RESPONSE); broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT); broadcastIntent.putExtra(RESPONSE_SGV, egvRecord.getBGValue()); broadcastIntent.putExtra(RESPONSE_TREND, egvRecord.getTrend().getID()); broadcastIntent.putExtra(RESPONSE_TIMESTAMP, egvRecord.getDisplayTime().getTime()); broadcastIntent.putExtra(RESPONSE_NEXT_UPLOAD_TIME, nextUploadTime); broadcastIntent.putExtra(RESPONSE_UPLOAD_STATUS, uploadStatus); broadcastIntent.putExtra(RESPONSE_DISPLAY_TIME, displayTime); if (json!=null) broadcastIntent.putExtra(RESPONSE_JSON, json.toString()); broadcastIntent.putExtra(RESPONSE_BAT, batLvl); sendBroadcast(broadcastIntent); }
Example #15
Source File: Bubble.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
static void AreWeDone() { if (s_acumulatedSize < lens) { return; } long now = JoH.tsl(); String SensorSn = PersistentStore.getString("LibreSN"); byte[] data = Arrays.copyOfRange(s_full_data, 0, 344); boolean checksum_ok = NFCReaderX.HandleGoodReading(SensorSn, data, now, true, patchUid, patchInfo); int expectedSize = lens + BUBBLE_FOOTER; InitBuffer(expectedSize); errorCount = 0; Log.e(TAG, "We have all the data that we need " + s_acumulatedSize + " checksum_ok = " + checksum_ok + HexDump.dumpHexString(data)); }
Example #16
Source File: BgReading.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
public static BgReading getForTimestampExists(double timestamp) { Sensor sensor = Sensor.currentSensor(); if (sensor != null) { BgReading bgReading = new Select() .from(BgReading.class) .where("Sensor = ? ", sensor.getId()) .where("timestamp <= ?", (timestamp + (60 * 1000))) // 1 minute padding (should never be that far off, but why not) .orderBy("timestamp desc") .executeSingle(); if (bgReading != null && Math.abs(bgReading.timestamp - timestamp) < (3 * 60 * 1000)) { //cool, so was it actually within 4 minutes of that bg reading? Log.i(TAG, "getForTimestamp: Found a BG timestamp match"); return bgReading; } } Log.d(TAG, "getForTimestamp: No luck finding a BG timestamp match"); return null; }
Example #17
Source File: G5CollectionService.java From xDrip with GNU General Public License v3.0 | 6 votes |
@Override public void onCharacteristicWrite(final BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic, final int status) { Log.e(TAG, "OnCharacteristic WRITE started: " + getUUIDName(characteristic.getUuid()) + " status: " + getStatusName(status)); //Log.e(TAG, "Write Status " + String.valueOf(status)); //Log.e(TAG, "Characteristic " + String.valueOf(characteristic.getUuid())); if (enforceMainThread()) { Handler iHandler = new Handler(Looper.getMainLooper()); iHandler.post(new Runnable() { @Override public void run() { processOnCharacteristicWrite(gatt, characteristic, status); } }); } else { processOnCharacteristicWrite(gatt, characteristic, status); } }
Example #18
Source File: CalRecord.java From xDrip-Experimental with GNU General Public License v3.0 | 6 votes |
public CalRecord(byte[] packet) { super(packet); slope = ByteBuffer.wrap(packet).order(ByteOrder.LITTLE_ENDIAN).getDouble(8); intercept = ByteBuffer.wrap(packet).order(ByteOrder.LITTLE_ENDIAN).getDouble(16); scale = ByteBuffer.wrap(packet).order(ByteOrder.LITTLE_ENDIAN).getDouble(24); unk[0] = packet[32]; unk[1] = packet[33]; unk[2] = packet[34]; decay = ByteBuffer.wrap(packet).order(ByteOrder.LITTLE_ENDIAN).getDouble(35); numRecords = packet[43]; long displayTimeOffset = (getDisplayTime().getTime() - getSystemTime().getTime()) / (1000); int start = 44; for (int i = 0; i < numRecords; i++) { Log.d("CalDebug","Loop #"+i); byte[] temp = new byte[SUB_LEN]; System.arraycopy(packet, start, temp, 0, temp.length); calSubrecords[i] = new CalSubrecord(temp, displayTimeOffset); start += SUB_LEN; } Log.d("ShareTest", "slope: " + slope + " intercept: " + intercept); }
Example #19
Source File: Sensor.java From xDrip with GNU General Public License v3.0 | 6 votes |
public static boolean TableExists(String table) {//KS try { SQLiteDatabase db = Cache.openDatabase(); if (db != null) { db.rawQuery("SELECT * FROM " + table, null); Log.d("wearSENSOR", "TableExists table does NOT exist:" + table); return true; } else { Log.d("wearSENSOR", "TableExists Cache.openDatabase() failed."); return false; } } catch (Exception e) { Log.d("wearSENSOR", "TableExists CATCH error table:" + table); return false; } }
Example #20
Source File: WifiCollectionService.java From xDrip-Experimental with GNU General Public License v3.0 | 5 votes |
@Override public void onCreate() { foregroundServiceStarter = new ForegroundServiceStarter(getApplicationContext(), this); foregroundServiceStarter.start(); mContext = getApplicationContext(); dexCollectionService = this; prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); listenForChangeInSettings(); bgToSpeech = BgToSpeech.setupTTS(mContext); //keep reference to not being garbage collected Log.i(TAG, "onCreate: STARTING SERVICE"); }
Example #21
Source File: G5CollectionService.java From xDrip with GNU General Public License v3.0 | 5 votes |
private synchronized void doDisconnectMessage(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { Log.d(TAG, "doDisconnectMessage() start"); gatt.setCharacteristicNotification(controlCharacteristic, false); final DisconnectTxMessage disconnectTx = new DisconnectTxMessage(); characteristic.setValue(disconnectTx.byteSequence); gatt.writeCharacteristic(characteristic); gatt.disconnect(); Log.d(TAG, "doDisconnectMessage() finished"); }
Example #22
Source File: DexCollectionService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private boolean unBondBlucon() { if (static_use_blukon && Pref.getBooleanDefaultFalse("blukon_unbonding")) { Log.d(TAG, "Attempting to unbond blukon"); JoH.unBond(mDeviceAddress); return true; } else { return false; } }
Example #23
Source File: Preferences.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public void jumpToScreen(final String screenKey) { if (screenKey == null) return; UserError.Log.d(TAG, "jump to screen: " + screenKey); PreferenceScreen subPreferenceScreen = (PreferenceScreen) findPreference(screenKey); final AllPrefsFragment fragment = this; JoH.runOnUiThread(new Runnable() { @Override public void run() { clickScreen(fragment, subPreferenceScreen); } }); }
Example #24
Source File: Calibration.java From xDrip with GNU General Public License v3.0 | 5 votes |
private double calculateWeight() { double firstTimeStarted = Calibration.first().sensor_age_at_time_of_estimation; double lastTimeStarted = Calibration.last().sensor_age_at_time_of_estimation; double time_percentage = Math.min(((sensor_age_at_time_of_estimation - firstTimeStarted) / (lastTimeStarted - firstTimeStarted)) / (.85), 1); time_percentage = (time_percentage + .01); Log.i(TAG, "CALIBRATIONS TIME PERCENTAGE WEIGHT: " + time_percentage); return Math.max((((((slope_confidence + sensor_confidence) * (time_percentage))) / 2) * 100), 1); }
Example #25
Source File: Calibration.java From xDrip-Experimental with GNU General Public License v3.0 | 5 votes |
public static void createUpdate(String xDrip_sensor_uuid, double bg, long timeStamp, double intercept, double slope, double estimate_raw_at_time_of_calibration, double slope_confidence , double sensor_confidence, long raw_timestamp) { Sensor sensor = Sensor.getByUuid(xDrip_sensor_uuid); if (sensor == null) { Log.d("CALIBRATION", "No sensor found, ignoring cailbration"); return; } Calibration calibration = getByTimestamp(timeStamp); if (calibration != null) { Log.d("CALIBRATION", "updatinga an existing calibration"); } else { Log.d("CALIBRATION", "creating a new calibration"); calibration = new Calibration(); } calibration.sensor = sensor; calibration.bg = bg; calibration.timestamp = timeStamp; calibration.sensor_uuid = sensor.uuid; calibration.uuid = UUID.randomUUID().toString(); calibration.intercept = intercept; calibration.slope = slope; calibration.estimate_raw_at_time_of_calibration = estimate_raw_at_time_of_calibration; calibration.slope_confidence = slope_confidence; calibration.sensor_confidence = sensor_confidence; calibration.raw_timestamp = raw_timestamp; calibration.check_in = false; calibration.save(); }
Example #26
Source File: AlertPlayer.java From xDrip with GNU General Public License v3.0 | 5 votes |
private void revertCurrentVolume(final Context ctx) { AudioManager manager = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE); int currentVolume = manager.getStreamVolume(AudioManager.STREAM_MUSIC); Log.i(TAG, "revertCurrentVolume volumeBeforeAlert " + volumeBeforeAlert + " volumeForThisAlert " + volumeForThisAlert + " currentVolume " + currentVolume); if (volumeForThisAlert == currentVolume && (volumeBeforeAlert != -1) && (volumeForThisAlert != -1)) { // If the user has changed the volume, don't change it again. manager.setStreamVolume(AudioManager.STREAM_MUSIC, volumeBeforeAlert, 0); } volumeBeforeAlert = -1; volumeForThisAlert = - 1; }
Example #27
Source File: Notifications.java From xDrip with GNU General Public License v3.0 | 5 votes |
private void reportNoiseChanges()//KS TODO in wear BgGraphBuilder { final String this_noise_string=BgGraphBuilder.noiseString(BgGraphBuilder.last_noise); if (!BgGraphBuilder.noiseString(BgGraphBuilder.last_noise).equals(last_noise_string)) { Log.uel("Noise","Changed from: "+last_noise_string+" to "+this_noise_string); last_noise_string = this_noise_string; } }
Example #28
Source File: DexCollectionService.java From xDrip with GNU General Public License v3.0 | 5 votes |
@Override public void onCharacteristicChanged(BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic) { final PowerManager.WakeLock wakeLock1 = JoH.getWakeLock("DexCollectionService", 60000); try { final byte[] data = characteristic.getValue(); if (data != null && data.length > 0) { setSerialDataToTransmitterRawData(data, data.length); final String hexdump = HexDump.dumpHexString(data); //if (!hexdump.contains("0x00000000 00 ")) { if (data.length > 1 || data[0] != 0x00) { static_last_hexdump = hexdump; } if (d) Log.i(TAG, "onCharacteristicChanged entered " + hexdump); } lastdata = data; Inevitable.task("dex-set-failover", 1000, () -> { setFailoverTimer(); // restart the countdown // intentionally left hanging wakelock for 5 seconds after we receive something final PowerManager.WakeLock wakeLock2 = JoH.getWakeLock("DexCollectionLinger", 5000); }); } finally { /* if (Pref.getBoolean("bluetooth_frequent_reset", false)) { Log.e(TAG, "Resetting bluetooth due to constant reset option being set!"); JoH.restartBluetooth(getApplicationContext(), 5000); }*/ JoH.releaseWakeLock(wakeLock1); } }
Example #29
Source File: BgReading.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static synchronized BgReading bgReadingInsertFromG5(double calculated_value, long timestamp, String sourceInfoAppend) { final Sensor sensor = Sensor.currentSensor(); if (sensor == null) { Log.w(TAG, "No sensor, ignoring this bg reading"); return null; } // TODO slope!! final BgReading existing = getForPreciseTimestamp(timestamp, Constants.MINUTE_IN_MS); if (existing == null) { final BgReading bgr = new BgReading(); bgr.sensor = sensor; bgr.sensor_uuid = sensor.uuid; bgr.time_since_sensor_started = JoH.msSince(sensor.started_at); // is there a helper for this? bgr.timestamp = timestamp; bgr.uuid = UUID.randomUUID().toString(); bgr.calculated_value = calculated_value; bgr.raw_data = SPECIAL_G5_PLACEHOLDER; // placeholder bgr.appendSourceInfo("G5 Native"); if (sourceInfoAppend != null && sourceInfoAppend.length() > 0) { bgr.appendSourceInfo(sourceInfoAppend); } bgr.save(); if (JoH.ratelimit("sync wakelock", 15)) { final PowerManager.WakeLock linger = JoH.getWakeLock("G5 Insert", 4000); } Inevitable.stackableTask("NotifySyncBgr", 3000, () -> notifyAndSync(bgr)); return bgr; } else { return existing; } }
Example #30
Source File: ListenerService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static void requestAPK(String peerVersion) { if (peerVersion == null) return; if (!peerVersion.equals(apkBytesVersion)) { UserError.Log.d(TAG, "Requesting apk from start"); requestAPK(0); } else { UserError.Log.d(TAG, "Resuming request apk from: " + apkBytesRead + " for matching: " + peerVersion); requestAPK(apkBytesRead); } }