// 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); }
// 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(); }
// 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()); }
// JAVADOC COMMENT ELIDED public static RemoteDevice getRemoteDevice(Connection conn) throws IOException { return BluetoothConnection.getConnection(conn).getRemoteDevice(); }