Java Code Examples for com.eveningoutpost.dexdrip.utils.BgToSpeech#speak()
The following examples show how to use
com.eveningoutpost.dexdrip.utils.BgToSpeech#speak() .
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: NewDataObserver.java From xDrip with GNU General Public License v3.0 | 5 votes |
private static void textToSpeech(BgReading bgReading, BestGlucose.DisplayGlucose dg) { //Text to speech if (Pref.getBooleanDefaultFalse("bg_to_speech") || VehicleMode.shouldSpeak()) { if (dg == null) dg = BestGlucose.getDisplayGlucose(); if (dg != null) { BgToSpeech.speak(dg.mgdl, dg.timestamp, dg.delta_name); } else { BgToSpeech.speak(bgReading.calculated_value, bgReading.timestamp, bgReading.slopeName()); } } }
Example 2
Source File: NewDataObserver.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private static void textToSpeech(BgReading bgReading, BestGlucose.DisplayGlucose dg) { //Text to speech if (Pref.getBooleanDefaultFalse("bg_to_speech") || VehicleMode.shouldSpeak()) { if (dg == null) dg = BestGlucose.getDisplayGlucose(); if (dg != null) { BgToSpeech.speak(dg.mgdl, dg.timestamp, dg.delta_name); } else { BgToSpeech.speak(bgReading.calculated_value, bgReading.timestamp, bgReading.slopeName()); } } }
Example 3
Source File: BgSendQueue.java From xDrip-Experimental with GNU General Public License v3.0 | 4 votes |
public static void handleNewBgReading(BgReading bgReading, String operation_type, Context context) { PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "sendQueue"); wakeLock.acquire(); try { addToQueue(bgReading, operation_type); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Intent updateIntent = new Intent(Intents.ACTION_NEW_BG_ESTIMATE_NO_DATA); context.sendBroadcast(updateIntent); if(AppWidgetManager.getInstance(context).getAppWidgetIds(new ComponentName(context, xDripWidget.class)).length > 0){ context.startService(new Intent(context, WidgetUpdateService.class)); } if (prefs.getBoolean("broadcast_data_through_intents", false)) { //prepare data double calculated_value = bgReading.calculated_value; boolean hide_slope = bgReading.hide_slope; String slopeName = hide_slope?null:bgReading.slopeName(); int batteryLevel = getBatteryLevel(context); final long timestamp = bgReading.timestamp; Calibration cal = Calibration.last(); double raw = NightscoutUploader.getNightscoutRaw(bgReading, cal); double slope = BgReading.currentSlope(); //send broadcast BgEstimateBroadcaster.broadcastBgEstimate(calculated_value, raw, timestamp, slope, slopeName, batteryLevel, context); //just keep it alive for 3 more seconds to allow the watch to be updated // TODO: change NightWatch to not allow the system to sleep. powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "broadcastNightWatch").acquire(3000); } // send to wear if (prefs.getBoolean("wear_sync", false)) { /*By integrating the watch part of Nightwatch we inherited the same wakelock problems NW had - so adding the same quick fix for now. TODO: properly "wakelock" the wear (and probably pebble) services */ context.startService(new Intent(context, WatchUpdaterService.class)); powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "quickFix3").acquire(15000); } // send to pebble if(prefs.getBoolean("broadcast_to_pebble", false)) { context.startService(new Intent(context, PebbleSync.class)); } if (prefs.getBoolean("share_upload", false)) { Log.d("ShareRest", "About to call ShareRest!!"); String receiverSn = prefs.getString("share_key", "SM00000000").toUpperCase(); BgUploader bgUploader = new BgUploader(context); bgUploader.upload(new ShareUploadPayload(receiverSn, bgReading)); } context.startService(new Intent(context, SyncService.class)); //Text to speech Log.d("BgToSpeech", "gonna call speak"); BgToSpeech.speak(bgReading.calculated_value, bgReading.timestamp); } finally { wakeLock.release(); } }