private void deviceConnected() {
   //		Log.v(TAG, "Device connected.");
   if (mConnectionListener != null) {
     mConnectionListener.onDeviceConnected(this);
   }
   this.onDeviceConnected();
 }
 private void beforeDeviceClosed() {
   if (this.isConencted()) {
     //			Log.v(TAG, "Run before device disconnected.");
     if (mConnectionListener != null) {
       mConnectionListener.onBeforeDeviceClosed(this);
     }
     this.onBeforeConnectionClosed();
   }
 }
  private void deviceConnectionLost() {
    //		Log.v(TAG, "Lost the connection to the device.");
    if (mConnectionListener != null) {
      mConnectionListener.onDeviceConnectionLost(this);
    }

    // Try to reconnect.
    if (this.isBonded() && mReconnectOnConnectionLost) {
      //			Log.v(TAG, "Trying to reconnect to the device.");
      this.connect();
    }
  }