Java Code Examples for com.eveningoutpost.dexdrip.UtilityModels.CollectionServiceStarter#isWifiWixel()

The following examples show how to use com.eveningoutpost.dexdrip.UtilityModels.CollectionServiceStarter#isWifiWixel() . 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: WifiCollectionService.java    From xDrip-Experimental with GNU General Public License v3.0 6 votes vote down vote up
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Log.d(TAG, "onStartCommand called");
    if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
        stopSelf();
        return START_NOT_STICKY;
    }
    if (CollectionServiceStarter.isWifiWixel(getApplicationContext())
            || CollectionServiceStarter.isWifiandBTWixel(getApplicationContext())
            || CollectionServiceStarter.isWifiandDexbridgeWixel(getApplicationContext())) {
        runWixelReader();
        // For simplicity done here, would better happen once we know if we have a packet or not...
        setFailoverTimer();
    } else {
        stopSelf();
        return START_NOT_STICKY;
    }
    return START_STICKY;
}
 
Example 2
Source File: WifiCollectionService.java    From xDrip-Experimental with GNU General Public License v3.0 6 votes vote down vote up
public void setFailoverTimer() {
    Log.d(TAG, "setFailoverTimer called \n");
    if (CollectionServiceStarter.isWifiWixel(getApplicationContext())
            || CollectionServiceStarter.isWifiandBTWixel(getApplicationContext())
            || CollectionServiceStarter.isWifiandDexbridgeWixel(getApplicationContext())) {
        long retry_in = WixelReader.timeForNextRead();
        Log.e(TAG, "setFailoverTimer: Fallover Restarting in: " + (retry_in / (60 * 1000)) + " minutes");
        Calendar calendar = Calendar.getInstance();
        AlarmManager alarm = (AlarmManager) getSystemService(ALARM_SERVICE);
        
        long wakeTime = calendar.getTimeInMillis() + retry_in;
        PendingIntent serviceIntent = PendingIntent.getService(this, 0, new Intent(this, this.getClass()), 0);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            alarm.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, wakeTime, serviceIntent);
        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            alarm.setExact(AlarmManager.RTC_WAKEUP, wakeTime, serviceIntent);
        } else
            alarm.set(AlarmManager.RTC_WAKEUP, wakeTime, serviceIntent);
        
    } else {
        stopSelf();
    }
}
 
Example 3
Source File: Home.java    From xDrip-Experimental with GNU General Public License v3.0 4 votes vote down vote up
private void updateCurrentBgInfo() {
     setupCharts();
     final TextView notificationText = (TextView) findViewById(R.id.notices);
     notificationText.setText("");
     notificationText.setTextColor(Color.parseColor("#FF0000"));
     boolean isBTWixel = CollectionServiceStarter.isBteWixelorWifiandBtWixel(getApplicationContext());
     boolean isDexbridgeWixel = CollectionServiceStarter.isDexbridgeWixelorWifiandDexbridgeWixel(getApplicationContext());
     isBTShare = CollectionServiceStarter.isBTShare(getApplicationContext());
     isG5Share = CollectionServiceStarter.isBTG5(getApplicationContext());
     boolean isWifiWixel = CollectionServiceStarter.isWifiWixel(getApplicationContext());
     alreadyDisplayedBgInfoCommon = false; // reset flag
     
     boolean xDripViewer = XDripViewer.isxDripViewerMode(getApplicationContext());
     
     if(xDripViewer) {
         updateCurrentBgInfoForxDripViewer(notificationText);
     } else if (isBTShare) {
         updateCurrentBgInfoForBtShare(notificationText);
     } else if (isBTWixel || isDexbridgeWixel) {
         updateCurrentBgInfoForBtBasedWixel(notificationText);
     } else if (isWifiWixel) {
         updateCurrentBgInfoForWifiWixel(notificationText);
     }
     if (isG5Share) {
         updateCurrentBgInfoCommon(notificationText);
     }

     if (mPreferences.getLong("alerts_disabled_until", 0) > new Date().getTime()) {
         notificationText.append("\n ALL ALERTS DISABLED");
     } else if (mPreferences.getLong("low_alerts_disabled_until", 0) > new Date().getTime()
&&
mPreferences.getLong("high_alerts_disabled_until", 0) > new Date().getTime()) {
         notificationText.append("\nLOW AND HIGH ALERTS DISABLED");
     } else if (mPreferences.getLong("low_alerts_disabled_until", 0) > new Date().getTime()) {
         notificationText.append("\nLOW ALERTS DISABLED");
     } else if (mPreferences.getLong("high_alerts_disabled_until", 0) > new Date().getTime()) {
         notificationText.append("\nHIGH ALERTS DISABLED");
     }
     if(mPreferences.getBoolean("extra_status_line", false)) {
         extraStatusLineText.setText(extraStatusLine(mPreferences));
         extraStatusLineText.setVisibility(View.VISIBLE);
     } else {
         extraStatusLineText.setText("");
         extraStatusLineText.setVisibility(View.GONE);
     }
     NavigationDrawerFragment navigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id.navigation_drawer);
     navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout), menu_name, this);
 }