FileDocCategorySizeDatePackage
BluetoothPbapObexAuthenticator.javaAPI DocAndroid 5.1 API2657Thu Mar 12 22:22:50 GMT 2015android.bluetooth.client.pbap

BluetoothPbapObexAuthenticator

public class BluetoothPbapObexAuthenticator extends Object implements javax.obex.Authenticator

Fields Summary
private static final String
TAG
private String
mSessionKey
private boolean
mReplied
private final android.os.Handler
mCallback
Constructors Summary
public BluetoothPbapObexAuthenticator(android.os.Handler callback)


       
        mCallback = callback;
    
Methods Summary
public javax.obex.PasswordAuthenticationonAuthenticationChallenge(java.lang.String description, boolean isUserIdRequired, boolean isFullAccess)

        PasswordAuthentication pa = null;

        mReplied = false;

        Log.d(TAG, "onAuthenticationChallenge: sending request");
        mCallback.obtainMessage(BluetoothPbapObexSession.OBEX_SESSION_AUTHENTICATION_REQUEST)
                .sendToTarget();

        synchronized (this) {
            while (!mReplied) {
                try {
                    Log.v(TAG, "onAuthenticationChallenge: waiting for response");
                    this.wait();
                } catch (InterruptedException e) {
                    Log.e(TAG, "Interrupted while waiting for challenge response");
                }
            }
        }

        if (mSessionKey != null && mSessionKey.length() != 0) {
            Log.v(TAG, "onAuthenticationChallenge: mSessionKey=" + mSessionKey);
            pa = new PasswordAuthentication(null, mSessionKey.getBytes());
        } else {
            Log.v(TAG, "onAuthenticationChallenge: mSessionKey is empty, timeout/cancel occured");
        }

        return pa;
    
public byte[]onAuthenticationResponse(byte[] userName)

        /* required only in case PCE challenges PSE which we don't do now */
        return null;
    
public synchronized voidsetReply(java.lang.String key)

        Log.d(TAG, "setReply key=" + key);

        mSessionKey = key;
        mReplied = true;

        notify();