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 |
Methods Summary |
---|
public void | abort()
mAborted = true;
if (mOp != null) {
try {
mOp.abort();
} catch (IOException e) {
Log.e(TAG, "Exception occured when trying to abort", e);
}
}
|
protected void | checkResponseCode(int responseCode)
Log.v(TAG, "checkResponseCode");
/* nothing here by dafault */
|
public void | execute(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 boolean | isSuccess()
return (mResponseCode == ResponseCodes.OBEX_HTTP_OK);
|
protected void | readResponse(java.io.InputStream stream)
Log.v(TAG, "readResponse");
/* nothing here by default */
|
protected void | readResponseHeaders(javax.obex.HeaderSet headerset)
Log.v(TAG, "readResponseHeaders");
/* nothing here by dafault */
|