/**
  * Constructor. Prepares a new Bluetooth_connect session.
  *
  * @param context The UI Activity Context
  */
 public BluetoothService(Context context) {
   mAdapter = BTControl.getInstance(context).getAdapter();
   D = BTControl.getInstance(context).IsBluetoothEnabled();
   BTControl.getInstance(context).get_address();
   mState = STATE_NONE;
   mHandler = BTMessageHandler.getInstance(context);
 }
 /** Indicate that the connection attempt failed and notify the UI Activity. */
 private void connectionFailed(int arg1, int arg2) {
   setState(STATE_LISTEN);
   mHandler.obtainMessage(BTMessageHandler.MESSAGE_CONNECTION_FAIL, arg1, arg2).sendToTarget();
 }