public SensorRecord(byte[] packet) { super(packet); unfiltered = ByteBuffer.wrap(packet).order(ByteOrder.LITTLE_ENDIAN).getInt(OFFSET_UNFILTERED); filtered = ByteBuffer.wrap(packet).order(ByteOrder.LITTLE_ENDIAN).getInt(OFFSET_FILTERED); byte [] usRSSI = new byte[]{packet[17],packet[16]}; rssi = usRSSI[0] << 8 | usRSSI[1]; //rssi = ByteBuffer.wrap(packet).order(ByteOrder.LITTLE_ENDIAN).getShort(OFFSET_RSSI); Log.d("ShareTest", "filtered: " + filtered + " unfiltered: " + unfiltered); }
public AuthChallengeTxMessage(byte[] challenge) { challengeHash = challenge; data = ByteBuffer.allocate(9); data.put(opcode); data.put(challengeHash); byteSequence = data.array(); UserError.Log.d(TAG,"AuthChallengeTX: "+ JoH.bytesToHex(byteSequence)); } }
private boolean isAtTop() { if (recyclerView != null) { int first_visible_item = ((LinearLayoutManager) recyclerView.getLayoutManager()).findFirstVisibleItemPosition(); if (D) UserError.Log.d(TAG, " First visible item position: " + first_visible_item); if (first_visible_item > 1) return false; } return true; }
protected synchronized void stopConnect(final String address) { UserError.Log.d(TAG, "Stopping connection with: " + address); if (I.connectionSubscription != null) { I.connectionSubscription.unsubscribe(); } I.isConnected = false; }
private static String defaultUnits() { try { final String country = Locale.getDefault().getCountry(); final String units = mmol_countries.contains(country) ? "mmol/l" : "mg/dl"; UserError.Log.d(TAG, "Country: " + country + " default units: " + units); return units; } catch (Exception e) { UserError.Log.e(TAG, "Exception trying to determine locale units: " + e); return "mg/dl"; } }
private static void uploadToShare(BgReading bgReading, boolean is_follower) { if ((!is_follower) && (Pref.getBooleanDefaultFalse("share_upload"))) { if (JoH.ratelimit("sending-to-share-upload", 10)) { UserError.Log.d("ShareRest", "About to call ShareRest!!"); String receiverSn = Pref.getString("share_key", "SM00000000").toUpperCase(); BgUploader bgUploader = new BgUploader(xdrip.getAppContext()); bgUploader.upload(new ShareUploadPayload(receiverSn, bgReading)); } } } }
private static void speakSlowly() { if (speakSlowly) { UserError.Log.d(TAG, "Speaking slowly"); threadSleep(SPEAK_SLOWLY_DELAY); } }
public CalRecord[] getRecentCalRecords() { Log.d(TAG, "Reading Cal Records page range..."); int recordType = Dex_Constants.RECORD_TYPES.CAL_SET.ordinal(); int endPage = readDataBasePageRange(recordType); Log.d(TAG, "Reading Cal Records page..."); return readDataBasePage(recordType, endPage); } public byte[] getRecentCalRecordsTest() {
public CalibrateTxMessage(int glucose, int dexTime) { init(opcode, length); this.glucose = glucose; data.putShort((short) glucose); data.putInt(dexTime); appendCRC(); UserError.Log.d(TAG, "CalibrateGlucoseTxMessage dbg: " + JoH.bytesToHex(byteSequence)); }
public void stop() { if (run_service_in_foreground) { Log.d(TAG, "should be moving out of foreground"); mService.stopForeground(true); } }
static void pushTreatmentFromPayloadString(String json) { if (json.length() < 3) return; Log.d(TAG, "Pushing json from GCM: " + json); Treatments.pushTreatmentFromJson(json); }
@Override public void run() { if (JoH.msSince(PersistentStore.getLong("gcm-bgs-batch-time")) > 4000) { Log.d(TAG, "Progressing BGSbatch due to timeout"); processBgsBatch(true); } } }, 5000);
private void setFailOverTimer() { if (Home.get_follower()) { final long retry_in = (5 * 60 * 1000); UserError.Log.d(TAG, "setFailoverTimer: Restarting in: " + (retry_in / (60 * 1000)) + " minutes"); nextWakeUpTime = JoH.tsl() + retry_in; //final PendingIntent wakeIntent = PendingIntent.getService(this, 0, new Intent(this, this.getClass()), 0); final PendingIntent wakeIntent = WakeLockTrampoline.getPendingIntent(this.getClass()); JoH.wakeUpIntent(this, retry_in, wakeIntent); } else { stopSelf(); } }
public BackFillTxMessage(int startDexTime, int endDexTime) { init(opcode, length); data.put((byte) 0x5); data.put((byte) 0x2); data.put((byte) 0x0); data.putInt(startDexTime); data.putInt(endDexTime); data.put(new byte[6]); appendCRC(); UserError.Log.d(TAG, "BackfillTxMessage dbg: " + JoH.bytesToHex(byteSequence)); }
@Override public void onCreate() { super.onCreate(); service = this; UserError.Log.d("FOREGROUND", "Current Service: " + service.getClass().getSimpleName()); startInForeground(); }
@Override public void onTagDiscovered(Tag tag) { Log.d(TAG, "Reader mode tag discovered"); doTheScan(context, tag, false); } }, NfcAdapter.FLAG_READER_NFC_V | NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK | NfcAdapter.FLAG_READER_NO_PLATFORM_SOUNDS, options);
public static void delete_by_timestamp(long timestamp, int accuracy, boolean from_interactive) { final Treatments t = byTimestamp(timestamp, accuracy); // do we need to alter default accuracy? if (t != null) { Log.d(TAG, "Deleting treatment closest to: " + JoH.dateTimeText(timestamp) + " matches uuid: " + t.uuid); delete_by_uuid(t.uuid, from_interactive); } else { Log.e(TAG, "Couldn't find a treatment near enough to " + JoH.dateTimeText(timestamp) + " to delete!"); } }
public static void pushTreatmentSyncToWatch(Treatments treatment, boolean is_new) { Log.d(TAG, "pushTreatmentSyncToWatch Add treatment to UploaderQueue."); if (Pref.getBooleanDefaultFalse("wear_sync")) { if (UploaderQueue.newEntryForWatch(is_new ? "insert" : "update", treatment) != null) { SyncService.startSyncService(3000); // sync in 3 seconds } } }
public KeepAliveTxMessage(int time) { this.time = time; data = ByteBuffer.allocate(2); data.put(new byte[]{(byte) opcode, (byte) this.time}); byteSequence = data.order(ByteOrder.LITTLE_ENDIAN).array(); UserError.Log.d(TAG, "New KeepAliveRequestTxMessage: " + JoH.bytesToHex(byteSequence)); } }
public static void deleteRandomData() { Random rand = new Random(); int minutes_ago_end = rand.nextInt(120); int minutes_ago_start = minutes_ago_end + rand.nextInt(35)+5; long ts_start = JoH.tsl() - minutes_ago_start * Constants.MINUTE_IN_MS; long ts_end = JoH.tsl() - minutes_ago_end * Constants.MINUTE_IN_MS; UserError.Log.d(TAG,"Deleting random bgreadings: "+JoH.dateTimeText(ts_start)+" -> "+JoH.dateTimeText(ts_end)); testDeleteRange(ts_start, ts_end); }