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

BluetoothPbapRequest

public abstract class BluetoothPbapRequest extends Object

Fields Summary
private static final String
TAG
protected static final byte
OAP_TAGID_ORDER
protected static final byte
OAP_TAGID_SEARCH_VALUE
protected static final byte
OAP_TAGID_SEARCH_ATTRIBUTE
protected static final byte
OAP_TAGID_MAX_LIST_COUNT
protected static final byte
OAP_TAGID_LIST_START_OFFSET
protected static final byte
OAP_TAGID_FILTER
protected static final byte
OAP_TAGID_FORMAT
protected static final byte
OAP_TAGID_PHONEBOOK_SIZE
protected static final byte
OAP_TAGID_NEW_MISSED_CALLS
protected javax.obex.HeaderSet
mHeaderSet
protected int
mResponseCode
private boolean
mAborted
private javax.obex.ClientOperation
mOp
Constructors Summary
public BluetoothPbapRequest()


      
        mHeaderSet = new HeaderSet();
    
Methods Summary
public voidabort()

        mAborted = true;

        if (mOp != null) {
            try {
                mOp.abort();
            } catch (IOException e) {
                Log.e(TAG, "Exception occured when trying to abort", e);
            }
        }
    
protected voidcheckResponseCode(int responseCode)

        Log.v(TAG, "checkResponseCode");

        /* nothing here by dafault */
    
public voidexecute(javax.obex.ClientSession session)

        Log.v(TAG, "execute");

        /* in case request is aborted before can be executed */
        if (mAborted) {
            mResponseCode = ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
            return;
        }

        try {
            mOp = (ClientOperation) session.get(mHeaderSet);

            /* make sure final flag for GET is used (PBAP spec 6.2.2) */
            mOp.setGetFinalFlag(true);

            /*
             * this will trigger ClientOperation to use non-buffered stream so
             * we can abort operation
             */
            mOp.continueOperation(true, false);

            readResponseHeaders(mOp.getReceivedHeader());

            InputStream is = mOp.openInputStream();
            readResponse(is);
            is.close();

            mOp.close();

            mResponseCode = mOp.getResponseCode();

            Log.d(TAG, "mResponseCode=" + mResponseCode);

            checkResponseCode(mResponseCode);
        } catch (IOException e) {
            Log.e(TAG, "IOException occured when processing request", e);
            mResponseCode = ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;

            throw e;
        }
    
public final booleanisSuccess()

        return (mResponseCode == ResponseCodes.OBEX_HTTP_OK);
    
protected voidreadResponse(java.io.InputStream stream)

        Log.v(TAG, "readResponse");

        /* nothing here by default */
    
protected voidreadResponseHeaders(javax.obex.HeaderSet headerset)

        Log.v(TAG, "readResponseHeaders");

        /* nothing here by dafault */