protected void updateNotification() { if (mCarInterface != null && mCarInterface.getsStatus() == ElmInterface.STATUS_OPEN_MONITORING) { mNoticeBuilder.setContentText(getString(R.string.msg_monitoring)); } else { mNoticeBuilder.setContentText(getString(R.string.msg_monitoring_stopped)); } mNoticeManager.notify(mNoticeID, mNoticeBuilder.build()); }
/** Monitors the interface and re-starts monitoring or re-opens interface as needed. */ protected void carInterfaceRestartIfNeeded() { int status = mCarInterface.getsStatus(); if (status == ElmInterface.STATUS_OPEN_STOPPED) { try { mCarInterface.monitorStart(); } catch (Exception ex) { Log.e(TAG, "ERROR STARTING CAR INTERFACE MONITORING", ex); } } else if (status != ElmInterface.STATUS_OPEN_MONITORING) { mCarInterface.deviceOpen(); // code flow continues when mDeviceOpenListener.onDeviceOpenEvent() is fired } updateNotification(); }