private void logAvailableSensors() { final List<android.hardware.Sensor> sensors = mSensorManager.getSensorList(android.hardware.Sensor.TYPE_ALL); Log.d(TAG, "=== LIST AVAILABLE SENSORS ==="); Log.d(TAG, String.format(Locale.getDefault(), "|%-35s|%-38s|%-6s|", "SensorName", "StringType", "Type")); for (android.hardware.Sensor sensor : sensors) { Log.v(TAG, String.format(Locale.getDefault(), "|%-35s|%-38s|%-6s|", sensor.getName(), sensor.getStringType(), sensor.getType())); } Log.d(TAG, "=== LIST AVAILABLE SENSORS ==="); }
public static void runPackageInstaller(final byte[] buffer) { if (buffer == null) return; try { UserError.Log.ueh(TAG, "Running demigod package installer with payload size: " + buffer.length); installPackage(xdrip.getAppContext(), buffer, BuildConfig.APPLICATION_ID); } catch (Exception e) { UserError.Log.e(TAG, e.toString()); } }
public void authenticateConnection() { Log.i(TAG, "Trying to auth"); String receiverSn = prefs.getString("share_key", "SM00000000").toUpperCase() + "000000"; if(receiverSn.compareTo("SM00000000000000") == 0) { // They havnt set their serial number, dont bond! Log.v(TAG, "Auth Characteristic found: " + mAuthenticationCharacteristic.toString()); if (mAuthenticationCharacteristic.setValue(bondkey)) { mBluetoothGatt.writeCharacteristic(mAuthenticationCharacteristic); Log.w(TAG, "Authentication Characteristic IS NULL"); setRetryTimer(); Log.w(TAG, "CRADLE SERVICE IS NULL");
public void authenticateConnection() { Log.i(TAG, "Trying to auth"); String receiverSn = prefs.getString("share_key", "SM00000000").toUpperCase() + "000000"; if(receiverSn.compareTo("SM00000000000000") == 0) { // They havnt set their serial number, dont bond! Log.v(TAG, "Auth Characteristic found: " + mAuthenticationCharacteristic.toString()); if (mAuthenticationCharacteristic.setValue(bondkey)) { mBluetoothGatt.writeCharacteristic(mAuthenticationCharacteristic); Log.w(TAG, "Authentication Characteristic IS NULL"); setRetryTimer(); Log.w(TAG, "CRADLE SERVICE IS NULL");
Log.v(TAG, "buildDictionary: slopeOrdinal-" + slopeOrdinal + " bgReading-" + bgReadingS + // " now-" + (int) now.getTime() / 1000 + " bgTime-" + (int) (dg.timestamp / 1000) + // " phoneTime-" + (int) (new Date().getTime() / 1000) + " getBgDelta-" + getBgDelta()); Log.v(TAG, "buildDictionary: slopeOrdinal-" + slopeOrdinal + " bgReading-" + bgReadingS + // " now-" + (int) now.getTime() / 1000 + " bgTime-" + (int) (this.bgReading.timestamp / 1000) + // " phoneTime-" + (int) (new Date().getTime() / 1000) + " getBgDelta-" + getBgDelta());
public static AlertType alertTypegetOnly() { ActiveBgAlert aba = getOnly(); if (aba == null) { Log.v(TAG, "ActiveBgAlert: alertTypegetOnly returning null"); return null; } AlertType alert = AlertType.get_alert(aba.alert_uuid); if(alert == null) { Log.d(TAG, "alertTypegetOnly did not find the active alert as part of existing alerts. returning null"); // removing the alert to be in a better state. ClearData(); return null; } if(!alert.uuid.equals(aba.alert_uuid)) { Log.wtf(TAG, "AlertType.get_alert did not return the correct alert"); } return alert; }
public void find_slope() { List<BgReading> last_2 = BgReading.latest(2); // FYI: By default, assertions are disabled at runtime. Add "-ea" to commandline to enable. // https://docs.oracle.com/javase/7/docs/technotes/guides/language/assert.html assert last_2.get(0).uuid.equals(this.uuid) : "Invariant condition not fulfilled: calculating slope and current reading wasn't saved before"; if ((last_2 != null) && (last_2.size() == 2)) { calculated_value_slope = calculateSlope(this, last_2.get(1)); save(); } else if ((last_2 != null) && (last_2.size() == 1)) { calculated_value_slope = 0; save(); } else { if (JoH.ratelimit("no-bg-couldnt-find-slope", 15)) { Log.w(TAG, "NO BG? COULDNT FIND SLOPE!"); } } }
public static ActiveBgAlert getOnly() { try { ActiveBgAlert aba = new Select() .from(ActiveBgAlert.class) .orderBy("_ID asc") .executeSingle(); if (aba != null) { Log.v(TAG, "ActiveBgAlert getOnly aba = " + aba.toString()); } else { Log.v(TAG, "ActiveBgAlert getOnly returning null"); } return aba; } catch (android.database.sqlite.SQLiteException e) { Log.d(TAG,"ActiveBgAlert rebuilding table strcuture"); fixUpTable(); return null; } }
@Override public void onServicesDiscovered(BluetoothGatt gatt, int status) { Log.d(TAG, "services discovered " + status); if (status == BluetoothGatt.GATT_SUCCESS && mBluetoothGatt != null) { mShareService = mBluetoothGatt.getService(DexShareAttributes.CradleService); if(mShareService == null) { mShareService = mBluetoothGatt.getService(DexShareAttributes.CradleService2); share2 = true; } else { share2 = false; } assignCharacteristics(); authenticateConnection(); gattSetupStep(); } else { Log.w(TAG, "No Services Discovered!"); } }
public static AlertType alertTypegetOnly(final ActiveBgAlert aba) { if (aba == null) { Log.v(TAG, "ActiveBgAlert: alertTypegetOnly returning null"); return null; } AlertType alert = AlertType.get_alert(aba.alert_uuid); if(alert == null) { Log.d(TAG, "alertTypegetOnly did not find the active alert as part of existing alerts. returning null"); // removing the alert to be in a better state. ClearData(); return null; } if(!alert.uuid.equals(aba.alert_uuid)) { Log.wtf(TAG, "AlertType.get_alert did not return the correct alert"); } return alert; }
public static AlertType alertTypegetOnly(final ActiveBgAlert aba) { if (aba == null) { Log.v(TAG, "ActiveBgAlert: alertTypegetOnly returning null"); return null; } AlertType alert = AlertType.get_alert(aba.alert_uuid); if(alert == null) { Log.d(TAG, "alertTypegetOnly did not find the active alert as part of existing alerts. returning null"); // removing the alert to be in a better state. ClearData(); return null; } if(!alert.uuid.equals(aba.alert_uuid)) { Log.wtf(TAG, "AlertType.get_alert did not return the correct alert"); } return alert; }
public static String getTBR() { final String statusLine = getLastStatusLine(); if (statusLine.length() == 0) return ""; final String check = statusLine.replaceAll("[^%]", ""); if (check.length() > 0) { int index1 = 0, index2 = 4; UserError.Log.v(TAG, statusLine); if (statusLine.lastIndexOf('%') == 3) index2 = 4; else if (statusLine.lastIndexOf('%') == 2) index2 = 3; else if (statusLine.lastIndexOf('%') == 1) index2 = 2; return statusLine.substring(index1, index2); } else if (check.length() == 0) return "100%"; else return "???"; }
public static String getTBR() { final String statusLine = getLastStatusLine(); if (statusLine.length() == 0) return ""; final String check = statusLine.replaceAll("[^%]", ""); if (check.length() > 0) { int index1 = 0, index2 = 4; UserError.Log.v(TAG, statusLine); if (statusLine.lastIndexOf('%') == 3) index2 = 4; else if (statusLine.lastIndexOf('%') == 2) index2 = 3; else if (statusLine.lastIndexOf('%') == 1) index2 = 2; return statusLine.substring(index1, index2); } else if (check.length() == 0) return "100%"; else return "???"; }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { if (status == BluetoothGatt.GATT_SUCCESS) { Log.i(TAG, "Characteristic Read"); byte[] value = characteristic.getValue(); if(value != null) { Log.i(TAG, "VALUE" + value); } else { Log.w(TAG, "Characteristic was null"); } nextGattStep(); } else { Log.w(TAG, "Characteristic failed to read"); } }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { if (status == BluetoothGatt.GATT_SUCCESS) { Log.i(TAG, "Characteristic Read"); byte[] value = characteristic.getValue(); if(value != null) { Log.i(TAG, "VALUE" + value); } else { Log.w(TAG, "Characteristic was null"); } nextGattStep(); } else { Log.w(TAG, "Characteristic failed to read"); } }
private static void writeLog(String logFile, String logLine) { PrintWriter pWriter = null; try { pWriter = new PrintWriter(new BufferedWriter(new FileWriter(logFile, true))); pWriter.println(logLine); } catch (IOException ioe) { Log.w(TAG, "log write error: " + ioe.toString()); } finally { if (pWriter != null){ pWriter.flush(); pWriter.close(); } } }
private static void writeLog(String logFile, String logLine) { PrintWriter pWriter = null; try { pWriter = new PrintWriter(new BufferedWriter(new FileWriter(logFile, true))); pWriter.println(logLine); } catch (IOException ioe) { Log.w(TAG, "log write error: " + ioe.toString()); } finally { if (pWriter != null){ pWriter.flush(); pWriter.close(); } } }
private static void writeLog(String logFile, String logLine) { PrintWriter pWriter = null; try { pWriter = new PrintWriter(new BufferedWriter(new FileWriter(logFile, true))); pWriter.println(logLine); } catch (IOException ioe) { Log.w(TAG, "log write error: " + ioe.toString()); } finally { if (pWriter != null){ pWriter.flush(); pWriter.close(); } } }
public static void schedule() { if (JoH.pratelimit("daily-job-schedule", 60000)) { UserError.Log.uel(TAG, JoH.dateTimeText(JoH.tsl()) + " Job Scheduled"); // Debug only new JobRequest.Builder(TAG) .setPeriodic(Constants.DAY_IN_MS, Constants.HOUR_IN_MS * 12) .setRequiresDeviceIdle(true) .setRequiresCharging(true) .setRequiredNetworkType(JobRequest.NetworkType.UNMETERED) .setUpdateCurrent(true) .build() .schedule(); } } }
public static void schedule() { if (JoH.pratelimit("daily-job-schedule", 60000)) { UserError.Log.uel(TAG, JoH.dateTimeText(JoH.tsl()) + " Job Scheduled"); // Debug only new JobRequest.Builder(TAG) .setPeriodic(Constants.DAY_IN_MS, Constants.HOUR_IN_MS * 12) .setRequiresDeviceIdle(true) .setRequiresCharging(true) .setRequiredNetworkType(JobRequest.NetworkType.UNMETERED) .setUpdateCurrent(true) .build() .schedule(); } } }