當前位置: 首頁>>代碼示例>>Java>>正文


Java UserError類代碼示例

本文整理匯總了Java中com.eveningoutpost.dexdrip.Models.UserError的典型用法代碼示例。如果您正苦於以下問題:Java UserError類的具體用法?Java UserError怎麽用?Java UserError使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UserError類屬於com.eveningoutpost.dexdrip.Models包,在下文中一共展示了UserError類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isSafeToDeleteDB

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
private boolean isSafeToDeleteDB() {//TODO remove once confirm not needed
    TransmitterData last_bg = TransmitterData.last();
    if (last_bg != null && last_send_previous <= last_bg.timestamp) {
        Log.d(TAG, "onDataChanged SYNC_DB_PATH requestData for last_send_previous < last_bg.timestamp:" + JoH.dateTimeText(last_send_previous) + "<="+ JoH.dateTimeText(last_bg.timestamp));
        requestData();
        return false;
    }
    if (mPrefs.getBoolean("sync_wear_logs", false)) {
        UserError last_log = UserError.last();
        if (last_log != null && last_send_previous_log <= last_log.timestamp) {
            Log.d(TAG, "onDataChanged SYNC_DB_PATH requestData for last_send_previous_log < last_log.timestamp:" + JoH.dateTimeText(last_send_previous_log) + "<=" + JoH.dateTimeText((long) last_log.timestamp));
            return false;
        }
    }
    return true;
}
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:17,代碼來源:ListenerService.java

示例2: background_automata

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
public synchronized void background_automata(final int timeout) {
    if (background_launch_waiting) {
        UserError.Log.d(TAG, "Blocked by existing background automata pending");
        return;
    }
    final PowerManager.WakeLock wl = JoH.getWakeLock("jam-g5-background", timeout + 1000);
    background_launch_waiting = true;
    new Thread(() -> {
        try {
            Thread.sleep(timeout);
        } catch (InterruptedException e) {
            //
        }
        background_launch_waiting = false;
        JoH.releaseWakeLock(wl);
        automata();
    }).start();
}
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:19,代碼來源:Ob1G5CollectionService.java

示例3: discover_services

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
private synchronized void discover_services() {
    UserError.Log.d(TAG, "discover_services()");
    awaiting_data = false; // reset
    awaiting_ack = false;
    services_discovered = false;
    service_discovery_count++;
    if (mBluetoothGatt != null) {
        if (mConnectionState == STATE_CONNECTED) {

            mBluetoothGatt.discoverServices();
            JoH.runOnUiThreadDelayed(new Runnable() {
                @Override
                public void run() {
                    if ((!services_discovered) && (service_discovery_count < 10)) {
                        Log.d(TAG, "Timeout discovering services - retrying...");
                        discover_services();
                    }
                }
            }, (5000 + (500 * service_discovery_count)));
        } else {
            Log.e(TAG, "Cannot discover services as we are not connected");
        }
    } else {
        Log.e(TAG, "mBluetoothGatt is null!");
    }
}
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:27,代碼來源:BluetoothGlucoseMeter.java

示例4: tryGattRefresh

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
public void tryGattRefresh() {
    if (JoH.ratelimit("ob1-gatt-refresh", 60)) {
        try {
            if (connection != null)
                UserError.Log.d(TAG, "Trying gatt refresh queue");
            connection.queue((new GattRefreshOperation(0))).timeout(2, TimeUnit.SECONDS).subscribe(
                    readValue -> {
                        UserError.Log.d(TAG, "Refresh OK: " + readValue);
                    }, throwable -> {
                        UserError.Log.d(TAG, "Refresh exception: " + throwable);
                    });
        } catch (Exception e) {
            UserError.Log.d(TAG, "Got exception trying gatt refresh: " + e);
        }
    } else {
        UserError.Log.d(TAG, "Gatt refresh rate limited");
    }
}
 
開發者ID:jamorham,項目名稱:xDrip-plus,代碼行數:19,代碼來源:Ob1G5CollectionService.java

示例5: discover_services

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
private synchronized void discover_services() {
    if (state == STATE.DISCOVER) {
        if (connection != null) {
            if (d)
                UserError.Log.d(TAG, "Local bonding state: " + (isDeviceLocallyBonded() ? "BONDED" : "NOT Bonded"));
            stopDisover();
            discoverSubscription = connection.discoverServices(10, TimeUnit.SECONDS).subscribe(this::onServicesDiscovered, this::onDiscoverFailed);
        } else {
            UserError.Log.e(TAG, "No connection when in DISCOVER state - reset");
            state = STATE.INIT;
            background_automata();
        }
    } else {
        UserError.Log.wtf(TAG, "Attempt to discover when not in DISCOVER state");
    }
}
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:17,代碼來源:Ob1G5CollectionService.java

示例6: getView

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    View view = convertView;
    if (view == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.item_user_error, null);
    }
    LinearLayout row = (LinearLayout) view.findViewById(R.id.errorRow);
    TextView shortText = (TextView) view.findViewById(R.id.errorShort);
    TextView longText = (TextView) view.findViewById(R.id.errorLong);
    TextView timestamp = (TextView) view.findViewById(R.id.errorTimestamp);

    UserError error = list.get(position);

    row.setBackgroundColor(backgroundFor(error.severity));
    shortText.setText(error.shortError);
    longText.setText(error.message);
    timestamp.setText(dateformatter(error.timestamp));
    return view;
}
 
開發者ID:jamorham,項目名稱:xDrip-plus,代碼行數:21,代碼來源:ErrorListAdapter.java

示例7: tryLoadingSavedMAC

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
private void tryLoadingSavedMAC() {
    if ((transmitterMAC == null) || (!transmitterIDmatchingMAC.equals(transmitterID))) {
        if (transmitterID != null) {
            final String this_mac = PersistentStore.getString(OB1G5_MACSTORE + transmitterID);
            if (this_mac.length() == 17) {
                UserError.Log.d(TAG, "Loaded stored MAC for: " + transmitterID + " " + this_mac);
                transmitterMAC = this_mac;
                transmitterIDmatchingMAC = transmitterID;
            } else {
                UserError.Log.d(TAG, "Did not find any saved MAC for: " + transmitterID);
            }
        } else {
            UserError.Log.e(TAG, "Could not load saved mac as transmitter id isn't set!");
        }
    } else {
        UserError.Log.d(TAG, "MAC for transmitter id already populated: " + transmitterID + " " + transmitterMAC);
    }
}
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:19,代碼來源:Ob1G5CollectionService.java

示例8: prepareToWakeup

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
private synchronized void prepareToWakeup() {
    if (JoH.ratelimit("g5-wakeup-timer", 5)) {
        scheduleWakeUp(Constants.SECOND_IN_MS * 285, "anticipate");
    }

    if ((android_wear && wakeup_jitter > TOLERABLE_JITTER) || always_connect) {
        // TODO should be max_wakeup_jitter perhaps or set always_connect flag
        UserError.Log.d(TAG, "Not stopping connect due to " + (always_connect ? "always_connect flag" : "unreliable wake up"));
        state = STATE.CONNECT;
        background_automata(6000);
    } else {
        state = STATE.CLOSED; // Don't poll automata as we want to do this on waking
        stopConnect();
    }

}
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:17,代碼來源:Ob1G5CollectionService.java

示例9: getFakeWifiData

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
public static String getFakeWifiData() {

        long time = JoH.tsl();
        double divisor_scale = 5000000;
        double mod_raw = (time / divisor_scale) % Math.PI;
        double mod_filtered = ((time - 500000) / divisor_scale) % Math.PI;
        double raw_value = (Math.sin(mod_raw) * 100000) + 50000;
        double filtered_value = (Math.sin(mod_filtered) * 100000) + 50000;

        final JSONObject json = new JSONObject();
        try {
            json.put("CaptureDateTime", time);
            json.put("RelativeTime", 0L);
            json.put("TransmitterId", "123456");
            json.put("RawValue", (long) raw_value);
            json.put("FilteredValue", (long) filtered_value);
            json.put("BatteryLife", "100");
            json.put("ReceivedSignalStrength", 1);
            json.put("TransmissionId", 1);

        } catch (JSONException e) {
            UserError.Log.e(TAG, "Got weird Json exception: ", e);
        }
        return json.toString();
    }
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:26,代碼來源:MockDataSource.java

示例10: onScanFailure

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
private synchronized void onScanFailure(Throwable throwable) {

        if (throwable instanceof BleScanException) {
            final String info = handleBleScanException((BleScanException) throwable);
            lastScanError = info;
            UserError.Log.d(TAG, info);
            if (((BleScanException) throwable).getReason() == BleScanException.BLUETOOTH_DISABLED) {
                // Attempt to turn bluetooth on
                if (JoH.ratelimit("bluetooth_toggle_on", 30)) {
                    UserError.Log.d(TAG, "Pause before Turn Bluetooth on");
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException e) {
                        //
                    }
                    UserError.Log.e(TAG, "Trying to Turn Bluetooth on");
                    JoH.setBluetoothEnabled(xdrip.getAppContext(), true);
                }
            }
            // TODO count scan duration
            stopScan();
            backoff_automata();
        }
    }
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:25,代碼來源:Ob1G5CollectionService.java

示例11: check_and_enable_bluetooth

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
private void check_and_enable_bluetooth() {
    if (Build.VERSION.SDK_INT > 17) {
        try {
            final BluetoothManager bluetooth_manager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
            if (!bluetooth_manager.getAdapter().isEnabled()) {
                if (Pref.getBoolean("automatically_turn_bluetooth_on", true)) {
                    JoH.setBluetoothEnabled(getApplicationContext(), true);
                    //Toast.makeText(this, "Trying to turn Bluetooth on", Toast.LENGTH_LONG).show();
                    //} else {
                    //Toast.makeText(this, "Please turn Bluetooth on!", Toast.LENGTH_LONG).show();
                }
            }
        } catch (Exception e) {
            UserError.Log.e(TAG, "Error checking/enabling bluetooth: " + e);
        }
    }
}
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:18,代碼來源:PebbleWatchSync.java

示例12: pebble_watchdog

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
synchronized void pebble_watchdog(boolean online, String tag) {
    if (online) {
        last_seen_timestamp = JoH.tsl();
    } else {
        if (last_seen_timestamp == 0) return;
        if ((JoH.msSince(last_seen_timestamp) > 20 * Constants.MINUTE_IN_MS)) {
            if (!JoH.isOngoingCall()) {
                last_seen_timestamp = JoH.tsl();
                if (Pref.getBooleanDefaultFalse("bluetooth_watchdog")) {
                    UserError.Log.e(tag, "Triggering pebble watchdog reset!");
                    JoH.restartBluetooth(xdrip.getAppContext());
                } else {
                    UserError.Log.e(tag, "Would have Triggered pebble watchdog reset but bluetooth watchdog is disabled");
                }
            } else {
                UserError.Log.d(tag, "Ongoing call blocking pebble watchdog reset");
            }
        }
    }
}
 
開發者ID:jamorham,項目名稱:xDrip-plus,代碼行數:21,代碼來源:PebbleDisplayAbstract.java

示例13: chosenLocale

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
private static Locale chosenLocale() {
    // first get the default language
    Locale speech_locale = Locale.getDefault();
    try {
        final String tts_language = Pref.getStringDefaultBlank("speak_readings_custom_language").trim();
        // did the user specify another language for speech?
        if (tts_language.length() > 1) {
            final String[] lang_components = tts_language.split("_");
            final String country = (lang_components.length > 1) ? lang_components[1] : "";
            speech_locale = new Locale(lang_components[0], country, "");
        }
    } catch (Exception e) {
        UserError.Log.e(TAG, "Exception trying to use custom language: " + e);
    }
    return speech_locale;
}
 
開發者ID:jamorham,項目名稱:xDrip-plus,代碼行數:17,代碼來源:SpeechUtil.java

示例14: showInitialStatusHelper

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
private synchronized void showInitialStatusHelper() {
    initialDataQuality = ProcessInitialDataQuality.getInitialDataQuality(); // update
    if ((helper_dialog != null) && (helper_dialog.isShowing())) helper_dialog.dismiss();
    if ((status_helper_dialog != null) && (status_helper_dialog.isShowing())) {
        if (initial_status_binding != null)
            initial_status_binding.setIdq(initialDataQuality); // update data
        return;
    }

    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.collecting_initial_readings);
    initial_status_binding = PopupInitialStatusHelperBinding.inflate(getLayoutInflater());
    initial_status_binding.setIdq(initialDataQuality);
    if (microStatus == null) microStatus = new MicroStatusImpl();
    initial_status_binding.setMs(microStatus);
    initial_status_binding.setPrefs(new PrefsViewImpl());
    builder.setView(initial_status_binding.getRoot());
    status_helper_dialog = builder.create();
    status_helper_dialog.setCanceledOnTouchOutside(true);
    try {
        status_helper_dialog.show();
    } catch (Exception e) {
        UserError.Log.e(TAG, "Could not display calibration prompt helper: " + e);
    }
    keepScreenOn();
}
 
開發者ID:jamorham,項目名稱:xDrip-plus,代碼行數:27,代碼來源:Home.java

示例15: handleWakeup

import com.eveningoutpost.dexdrip.Models.UserError; //導入依賴的package包/類
private void handleWakeup() {
    if (always_scan) {
        UserError.Log.d(TAG, "Always scan mode");
        changeState(STATE.SCAN);
    } else {
        if (connectFailures > 0) {
            always_scan = true;
            UserError.Log.e(TAG, "Switching to scan always mode due to connect failures metric: " + connectFailures);
            changeState(STATE.SCAN);
        } else if ((connectNowFailures > 1) && (connectFailures < 0)) {
            UserError.Log.d(TAG, "Avoiding power connect due to failure metric: " + connectNowFailures + " " + connectFailures);
            changeState(STATE.CONNECT);
        } else {
            changeState(STATE.CONNECT_NOW);
        }
    }
}
 
開發者ID:jamorham,項目名稱:xDrip-plus,代碼行數:18,代碼來源:Ob1G5CollectionService.java


注:本文中的com.eveningoutpost.dexdrip.Models.UserError類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。