Example #1
0
  private void updateCurrentBgInfoForBtShare(TextView notificationText) {
    if ((android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR2)) {
      notificationText.setText(
          "Unfortunately your android version does not support Bluetooth Low Energy");
      return;
    }

    String receiverSn = prefs.getString("share_key", "SM00000000").toUpperCase();
    if (receiverSn.compareTo("SM00000000") == 0 || receiverSn.length() == 0) {
      notificationText.setText("Please set your Dex Receiver Serial Number in App Settings");
      return;
    }

    if (receiverSn.length() < 10) {
      notificationText.setText(
          "Double Check Dex Receiver Serial Number, should be 10 characters, don't forget the letters");
      return;
    }

    if (ActiveBluetoothDevice.first() == null) {
      notificationText.setText("Now pair with your Dexcom Share");
      return;
    }

    if (!Sensor.isActive()) {
      notificationText.setText("Now choose start your sensor in your settings");
      return;
    }

    displayCurrentInfo();
  }
Example #2
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    Log.d(TAG, "Item Clicked");
    final BluetoothDevice device = mLeDeviceListAdapter.getDevice(position);
    if (device == null || device.getName() == null) return;
    Toast.makeText(this, R.string.connecting_to_device, Toast.LENGTH_LONG).show();

    ActiveBluetoothDevice btDevice =
        new Select().from(ActiveBluetoothDevice.class).orderBy("_ID desc").executeSingle();

    final SharedPreferences prefs =
        PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    prefs.edit().putString("last_connected_device_address", device.getAddress()).apply();
    if (btDevice == null) {
      ActiveBluetoothDevice newBtDevice = new ActiveBluetoothDevice();
      newBtDevice.name = device.getName();
      newBtDevice.address = device.getAddress();
      newBtDevice.save();
    } else {
      btDevice.name = device.getName();
      btDevice.address = device.getAddress();
      btDevice.save();
    }
    if (device.getName().toLowerCase().contains("dexcom")) {
      if (!CollectionServiceStarter.isBTShare(getApplicationContext())) {
        prefs.edit().putString("dex_collection_method", "DexcomShare").apply();
        prefs.edit().putBoolean("calibration_notifications", false).apply();
      }
      if (prefs.getString("share_key", "SM00000000").compareTo("SM00000000") == 0
          || prefs.getString("share_key", "SM00000000").length() < 10) {
        requestSerialNumber(prefs);
      } else returnToHome();

    } else if (device.getName().toLowerCase().contains("bridge")) {
      if (!CollectionServiceStarter.isDexbridgeWixel(getApplicationContext()))
        prefs.edit().putString("dex_collection_method", "DexbridgeWixel").apply();
      if (prefs.getString("dex_txid", "00000").compareTo("00000") == 0
          || prefs.getString("dex_txid", "00000").length() < 5) {
        requestTransmitterId(prefs);
      } else returnToHome();

    } else if (device.getName().toLowerCase().contains("drip")) {
      if (!(CollectionServiceStarter.isBTWixel(getApplicationContext())
          || CollectionServiceStarter.isWifiandBTWixel(getApplicationContext()))) {
        prefs.edit().putString("dex_collection_method", "BluetoothWixel").apply();
      }
      returnToHome();
    } else {
      returnToHome();
    }
  }
Example #3
0
  private void updateCurrentBgInfoForBtBasedWixel(TextView notificationText) {
    if ((android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR2)) {
      notificationText.setText(
          "Unfortunately your android version does not support Bluetooth Low Energy");
      return;
    }

    if (ActiveBluetoothDevice.first() == null) {
      notificationText.setText("First pair with your BT device!");
      return;
    }
    updateCurrentBgInfoCommon(notificationText);
  }