import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
+import android.speech.tts.TextToSpeech;
+import android.speech.tts.TextToSpeech.OnInitListener;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
//import android.view.KeyEvent;
// Local Bluetooth adapter
private BluetoothAdapter mBluetoothAdapter = null;
+ private TextToSpeech tts;
+ private boolean tts_enabled = false;
// The Handler that gets information back from the Telemetry Service
static class IncomingHandler extends Handler {
return;
}
+ // Enable Text to Speech
+ tts = new TextToSpeech(this, new OnInitListener() {
+ public void onInit(int status) {
+ if (status == TextToSpeech.SUCCESS) tts_enabled = true;
+ if (tts_enabled) tts.speak("AltosDroid ready", TextToSpeech.QUEUE_ADD, null );
+ }
+ });
+
// Start Telemetry Service
startService(new Intent(AltosDroid.this, TelemetryService.class));
doUnbindService();
+ if (tts != null) tts.shutdown();
+
if(D) Log.e(TAG, "--- ON DESTROY ---");
}
Toast.makeText(this, R.string.bt_not_enabled, Toast.LENGTH_SHORT).show();
finish();
}
+ break;
}
}
//Message msg = Message.obtain(null, TelemetryService.MSG_CONNECT_TELEBT);
//msg.obj = device;
//mService.send(msg);
+ if (D) Log.i(TAG, "Connecting to " + device.getName());
mService.send(Message.obtain(null, TelemetryService.MSG_CONNECT, device));
} catch (RemoteException e) {
e.printStackTrace();
}
}
-
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();