Exemplo n.º 1
0
 // JAVADOC COMMENT ELIDED
 public boolean encrypt(Connection conn, boolean on) throws IOException {
   BluetoothConnection btconn = BluetoothConnection.getConnection(conn);
   if (!equals(btconn.getRemoteDevice())) {
     throw new IllegalArgumentException(
         "The specified connection " + "is not a connection to this RemoteDevice.");
   }
   if (on && !authenticate()) {
     return false;
   }
   return btconn.encrypt(on);
 }
Exemplo n.º 2
0
  // JAVADOC COMMENT ELIDED
  public boolean isAuthorized(Connection conn) throws IOException {
    BluetoothConnection btconn = BluetoothConnection.getConnection(conn);
    RemoteDevice device;

    try {
      device = btconn.getRemoteDevice();
    } catch (IllegalArgumentException e) {
      return false;
    }
    if (!equals(device)) {
      throw new IllegalArgumentException(
          "The specified connection " + "is not a connection to this RemoteDevice.");
    }

    return btconn.isServerSide() && btconn.isAuthorized();
  }
Exemplo n.º 3
0
  // JAVADOC COMMENT ELIDED
  public boolean authorize(Connection conn) throws IOException {
    BluetoothConnection btconn = BluetoothConnection.getConnection(conn);

    if (!equals(btconn.getRemoteDevice())) {
      throw new IllegalArgumentException(
          "The specified connection " + "is not a connection to this RemoteDevice.");
    }
    if (!btconn.isServerSide()) {
      throw new IllegalArgumentException(
          "The local device is client " + "rather than the server for the specified connection.");
    }

    return authenticate() && (isTrustedDevice() || btconn.isAuthorized() || btconn.authorize());
  }
Exemplo n.º 4
0
 // JAVADOC COMMENT ELIDED
 public static RemoteDevice getRemoteDevice(Connection conn) throws IOException {
   return BluetoothConnection.getConnection(conn).getRemoteDevice();
 }