summaryrefslogtreecommitdiffstats
path: root/obex/javax/obex/ClientOperation.java
diff options
context:
space:
mode:
Diffstat (limited to 'obex/javax/obex/ClientOperation.java')
-rw-r--r--obex/javax/obex/ClientOperation.java383
1 files changed, 177 insertions, 206 deletions
diff --git a/obex/javax/obex/ClientOperation.java b/obex/javax/obex/ClientOperation.java
index 5bc302a..b3807af 100644
--- a/obex/javax/obex/ClientOperation.java
+++ b/obex/javax/obex/ClientOperation.java
@@ -47,104 +47,82 @@ import java.io.ByteArrayOutputStream;
*/
public final class ClientOperation implements Operation, BaseStream {
- /**
- * Defines the basic packet length used by OBEX. Event OBEX packet has the
- * same basic format:<BR>
- * Byte 0: Request or Response Code
- * Byte 1&2: Length of the packet.
- */
- private static final int BASE_PACKET_LENGTH = 3;
-
- private ClientSession parent;
-
- private InputStream socketInput;
-
- private PrivateInputStream privateInput;
+ private ClientSession mParent;
- private PrivateOutputStream privateOutput;
+ private boolean mInputOpen;
- private boolean isClosed;
+ private PrivateInputStream mPrivateInput;
- private String exceptionMessage;
+ private boolean mPrivateInputOpen;
- private int maxPacketSize;
+ private PrivateOutputStream mPrivateOutput;
- private boolean isDone;
+ private boolean mPrivateOutputOpen;
- private boolean isGet;
+ private String mExceptionMessage;
- private HeaderSet requestHeaders;
+ private int mMaxPacketSize;
- private HeaderSet replyHeaders;
+ private boolean mOperationDone;
- private boolean isEndOfBodySent;
+ private boolean mGetOperation;
- private boolean inputStreamOpened;
+ private HeaderSet mRequestHeader;
- private boolean outputStreamOpened;
+ private HeaderSet mReplyHeader;
- private boolean isValidateConnected;
+ private boolean mEndOfBodySent;
/**
* Creates new OperationImpl to read and write data to a server
- *
- * @param in the input stream to read from
- *
* @param maxSize the maximum packet size
- *
* @param p the parent to this object
- *
- * @param headers the headers to set in the initial request
- *
* @param type <code>true</code> if this is a get request;
* <code>false</code. if this is a put request
+ * @param headers the headers to set in the initial request
*
* @throws IOExcpetion if the an IO error occured
*/
- public ClientOperation(InputStream in, int maxSize, ClientSession p, HeaderSet header,
- boolean type) throws IOException {
-
- parent = p;
- isEndOfBodySent = false;
- socketInput = in;
- isClosed = false;
- isDone = false;
- maxPacketSize = maxSize;
- isGet = type;
+ public ClientOperation(int maxSize, ClientSession p, HeaderSet header, boolean type)
+ throws IOException {
- inputStreamOpened = false;
- outputStreamOpened = false;
- isValidateConnected = false;
+ mParent = p;
+ mEndOfBodySent = false;
+ mInputOpen = true;
+ mOperationDone = false;
+ mMaxPacketSize = maxSize;
+ mGetOperation = type;
- privateInput = null;
- privateOutput = null;
+ mPrivateInputOpen = false;
+ mPrivateOutputOpen = false;
+ mPrivateInput = null;
+ mPrivateOutput = null;
- replyHeaders = new HeaderSet();
+ mReplyHeader = new HeaderSet();
- requestHeaders = new HeaderSet();
+ mRequestHeader = new HeaderSet();
int[] headerList = header.getHeaderList();
if (headerList != null) {
for (int i = 0; i < headerList.length; i++) {
- requestHeaders.setHeader(headerList[i], header.getHeader(headerList[i]));
+ mRequestHeader.setHeader(headerList[i], header.getHeader(headerList[i]));
}
}
- if ((header).authChall != null) {
- requestHeaders.authChall = new byte[(header).authChall.length];
- System.arraycopy((header).authChall, 0, requestHeaders.authChall, 0,
- (header).authChall.length);
+ if ((header).mAuthChall != null) {
+ mRequestHeader.mAuthChall = new byte[(header).mAuthChall.length];
+ System.arraycopy((header).mAuthChall, 0, mRequestHeader.mAuthChall, 0,
+ (header).mAuthChall.length);
}
- if ((header).authResp != null) {
- requestHeaders.authResp = new byte[(header).authResp.length];
- System.arraycopy((header).authResp, 0, requestHeaders.authResp, 0,
- (header).authResp.length);
+ if ((header).mAuthResp != null) {
+ mRequestHeader.mAuthResp = new byte[(header).mAuthResp.length];
+ System.arraycopy((header).mAuthResp, 0, mRequestHeader.mAuthResp, 0,
+ (header).mAuthResp.length);
}
- // requestHeaders = (HeaderSet)header;
}
/**
@@ -163,24 +141,24 @@ public final class ClientOperation implements Operation, BaseStream {
// }
//no compatible with sun-ri
- if ((isDone) && (replyHeaders.responseCode != ObexHelper.OBEX_HTTP_CONTINUE)) {
+ if ((mOperationDone) && (mReplyHeader.responseCode != ResponseCodes.OBEX_HTTP_CONTINUE)) {
throw new IOException("Operation has already ended");
}
- exceptionMessage = "Operation aborted";
- if ((!isDone) && (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE)) {
- isDone = true;
+ mExceptionMessage = "Operation aborted";
+ if ((!mOperationDone) && (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE)) {
+ mOperationDone = true;
/*
* Since we are not sending any headers or returning any headers then
* we just need to write and read the same bytes
*/
- parent.sendRequest(0xFF, null, replyHeaders, null);
+ mParent.sendRequest(ObexHelper.OBEX_OPCODE_ABORT, null, mReplyHeader, null);
- if (replyHeaders.responseCode != ResponseCodes.OBEX_HTTP_OK) {
+ if (mReplyHeader.responseCode != ResponseCodes.OBEX_HTTP_OK) {
throw new IOException("Invalid response code from server");
}
- exceptionMessage = null;
+ mExceptionMessage = null;
}
close();
@@ -199,12 +177,12 @@ public final class ClientOperation implements Operation, BaseStream {
*/
public synchronized int getResponseCode() throws IOException {
//avoid dup validateConnection
- if ((replyHeaders.responseCode == -1)
- || (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE)) {
+ if ((mReplyHeader.responseCode == -1)
+ || (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE)) {
validateConnection();
}
- return replyHeaders.responseCode;
+ return mReplyHeader.responseCode;
}
/**
@@ -226,7 +204,7 @@ public final class ClientOperation implements Operation, BaseStream {
*/
public String getType() {
try {
- return (String)replyHeaders.getHeader(HeaderSet.TYPE);
+ return (String)mReplyHeader.getHeader(HeaderSet.TYPE);
} catch (IOException e) {
return null;
}
@@ -242,7 +220,7 @@ public final class ClientOperation implements Operation, BaseStream {
*/
public long getLength() {
try {
- Long temp = (Long)replyHeaders.getHeader(HeaderSet.LENGTH);
+ Long temp = (Long)mReplyHeader.getHeader(HeaderSet.LENGTH);
if (temp == null) {
return -1;
@@ -262,27 +240,23 @@ public final class ClientOperation implements Operation, BaseStream {
* @throws IOException if an I/O error occurs
*/
public InputStream openInputStream() throws IOException {
- // TODO: this mode is not set yet.
- // if ((parent.mode & Connector.READ) == 0)
- // throw new IOException("write-only connection");
ensureOpen();
- if (inputStreamOpened)
+ if (mPrivateInputOpen)
throw new IOException("no more input streams available");
- if (isGet) {
+ if (mGetOperation) {
// send the GET request here
validateConnection();
- isValidateConnected = true;
} else {
- if (privateInput == null) {
- privateInput = new PrivateInputStream(this);
+ if (mPrivateInput == null) {
+ mPrivateInput = new PrivateInputStream(this);
}
}
- inputStreamOpened = true;
+ mPrivateInputOpen = true;
- return privateInput;
+ return mPrivateInput;
}
/**8
@@ -304,27 +278,25 @@ public final class ClientOperation implements Operation, BaseStream {
* @throws IOException if an I/O error occurs
*/
public OutputStream openOutputStream() throws IOException {
- // TODO: this mode is not set yet.
- // if ((parent.mode & Connector.WRITE) == 0)
- // throw new IOException("read-only connection");
+
ensureOpen();
ensureNotDone();
- if (outputStreamOpened)
+ if (mPrivateOutputOpen)
throw new IOException("no more output streams available");
- if (privateOutput == null) {
+ if (mPrivateOutput == null) {
// there are 3 bytes operation headers and 3 bytes body headers //
- privateOutput = new PrivateOutputStream(this, maxPacketSize - 6);
+ mPrivateOutput = new PrivateOutputStream(this, mMaxPacketSize - 6);
}
- outputStreamOpened = true;
+ mPrivateOutputOpen = true;
- return privateOutput;
+ return mPrivateOutput;
}
public int getMaxPacketSize() {
- return maxPacketSize - 6;
+ return mMaxPacketSize - 6;
}
/**
@@ -344,10 +316,10 @@ public final class ClientOperation implements Operation, BaseStream {
* @throws IOException if the operation has already ended or is closed
*/
public void close() throws IOException {
- isClosed = true;
- inputStreamOpened = false;
- outputStreamOpened = false;
- parent.setRequestInactive();
+ mInputOpen = false;
+ mPrivateInputOpen = false;
+ mPrivateOutputOpen = false;
+ mParent.setRequestInactive();
}
/**
@@ -359,10 +331,10 @@ public final class ClientOperation implements Operation, BaseStream {
*
* @throws IOException if this <code>Operation</code> has been closed
*/
- public HeaderSet getReceivedHeaders() throws IOException {
+ public HeaderSet getReceivedHeader() throws IOException {
ensureOpen();
- return replyHeaders;
+ return mReplyHeader;
}
/**
@@ -381,18 +353,18 @@ public final class ClientOperation implements Operation, BaseStream {
*/
public void sendHeaders(HeaderSet headers) throws IOException {
ensureOpen();
- if (isDone) {
+ if (mOperationDone) {
throw new IOException("Operation has already exchanged all data");
}
if (headers == null) {
- throw new NullPointerException("Headers may not be null");
+ throw new IOException("Headers may not be null");
}
int[] headerList = headers.getHeaderList();
if (headerList != null) {
for (int i = 0; i < headerList.length; i++) {
- requestHeaders.setHeader(headerList[i], headers.getHeader(headerList[i]));
+ mRequestHeader.setHeader(headerList[i], headers.getHeader(headerList[i]));
}
}
}
@@ -406,49 +378,50 @@ public final class ClientOperation implements Operation, BaseStream {
*
* @throws IOException if an IO error occurred
*/
+ /*
private boolean readResponse() throws IOException {
- replyHeaders.responseCode = socketInput.read();
- int packetLength = socketInput.read();
- packetLength = (packetLength << 8) + socketInput.read();
+ mReplyHeader.responseCode = mInput.read();
+ int packetLength = mInput.read();
+ packetLength = (packetLength << 8) + mInput.read();
if (packetLength > ObexHelper.MAX_PACKET_SIZE_INT) {
- if (exceptionMessage != null) {
+ if (mExceptionMessage != null) {
abort();
}
throw new IOException("Received a packet that was too big");
}
- if (packetLength > BASE_PACKET_LENGTH) {
- int dataLength = packetLength - BASE_PACKET_LENGTH;
+ if (packetLength > ObexHelper.BASE_PACKET_LENGTH) {
+ int dataLength = packetLength - ObexHelper.BASE_PACKET_LENGTH;
byte[] data = new byte[dataLength];
- int readLength = socketInput.read(data);
+ int readLength = mInput.read(data);
if (readLength != dataLength) {
throw new IOException("Received a packet without data as decalred length");
}
- byte[] body = ObexHelper.updateHeaderSet(replyHeaders, data);
+ byte[] body = ObexHelper.updateHeaderSet(mReplyHeader, data);
if (body != null) {
- privateInput.writeBytes(body, 1);
+ mPrivateInput.writeBytes(body, 1);
/*
* Determine if a body (0x48) header or an end of body (0x49)
* was received. If we received an end of body and
* a response code of OBEX_HTTP_OK, then the operation should
* end.
- */
- if ((body[0] == 0x49) && (replyHeaders.responseCode == ResponseCodes.OBEX_HTTP_OK)) {
+ *
+ if ((body[0] == 0x49) && (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_OK)) {
return false;
}
}
}
- if (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE) {
+ if (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE) {
return true;
} else {
return false;
}
}
-
+ */
/**
* Verifies that additional information may be sent. In other words, the
* operation is not done.
@@ -456,7 +429,7 @@ public final class ClientOperation implements Operation, BaseStream {
* @throws IOException if the operation is completed
*/
public void ensureNotDone() throws IOException {
- if (isDone) {
+ if (mOperationDone) {
throw new IOException("Operation has completed");
}
}
@@ -467,12 +440,12 @@ public final class ClientOperation implements Operation, BaseStream {
* @throws IOException if an exception needs to be thrown
*/
public void ensureOpen() throws IOException {
- parent.ensureOpen();
+ mParent.ensureOpen();
- if (exceptionMessage != null) {
- throw new IOException(exceptionMessage);
+ if (mExceptionMessage != null) {
+ throw new IOException(mExceptionMessage);
}
- if (isClosed) {
+ if (!mInputOpen) {
throw new IOException("Operation has already ended");
}
}
@@ -486,7 +459,7 @@ public final class ClientOperation implements Operation, BaseStream {
ensureOpen();
// to sure only one privateInput object exist.
- if (privateInput == null) {
+ if (mPrivateInput == null) {
startProcessing();
}
}
@@ -501,13 +474,13 @@ public final class ClientOperation implements Operation, BaseStream {
*
* @throws IOException if an IO error occurs
*/
- protected boolean sendRequest(int type) throws IOException {
+ private boolean sendRequest(int type) throws IOException {
boolean returnValue = false;
ByteArrayOutputStream out = new ByteArrayOutputStream();
int bodyLength = -1;
- byte[] headerArray = ObexHelper.createHeader(requestHeaders, true);
- if (privateOutput != null) {
- bodyLength = privateOutput.size();
+ byte[] headerArray = ObexHelper.createHeader(mRequestHeader, true);
+ if (mPrivateOutput != null) {
+ bodyLength = mPrivateOutput.size();
}
/*
@@ -518,40 +491,39 @@ public final class ClientOperation implements Operation, BaseStream {
* length, but it is a waste of resources if we can't send much of
* the body.
*/
- if ((BASE_PACKET_LENGTH + headerArray.length) > maxPacketSize) {
+ if ((ObexHelper.BASE_PACKET_LENGTH + headerArray.length) > mMaxPacketSize) {
int end = 0;
int start = 0;
// split & send the headerArray in multiple packets.
while (end != headerArray.length) {
//split the headerArray
- end = ObexHelper.findHeaderEnd(headerArray, start, maxPacketSize
- - BASE_PACKET_LENGTH);
+ end = ObexHelper.findHeaderEnd(headerArray, start, mMaxPacketSize
+ - ObexHelper.BASE_PACKET_LENGTH);
// can not split
if (end == -1) {
- isDone = true;
+ mOperationDone = true;
abort();
- // isDone = true;
- exceptionMessage = "Header larger then can be sent in a packet";
- isClosed = true;
+ mExceptionMessage = "Header larger then can be sent in a packet";
+ mInputOpen = false;
- if (privateInput != null) {
- privateInput.close();
+ if (mPrivateInput != null) {
+ mPrivateInput.close();
}
- if (privateOutput != null) {
- privateOutput.close();
+ if (mPrivateOutput != null) {
+ mPrivateOutput.close();
}
throw new IOException("OBEX Packet exceeds max packet size");
}
byte[] sendHeader = new byte[end - start];
System.arraycopy(headerArray, start, sendHeader, 0, sendHeader.length);
- if (!parent.sendRequest(type, sendHeader, replyHeaders, privateInput)) {
+ if (!mParent.sendRequest(type, sendHeader, mReplyHeader, mPrivateInput)) {
return false;
}
- if (replyHeaders.responseCode != ObexHelper.OBEX_HTTP_CONTINUE) {
+ if (mReplyHeader.responseCode != ResponseCodes.OBEX_HTTP_CONTINUE) {
return false;
}
@@ -569,27 +541,27 @@ public final class ClientOperation implements Operation, BaseStream {
if (bodyLength > 0) {
/*
- * Determine if I can send the whole body or just part of
+ * Determine if we can send the whole body or just part of
* the body. Remember that there is the 3 bytes for the
* response message and 3 bytes for the header ID and length
*/
- if (bodyLength > (maxPacketSize - headerArray.length - 6)) {
+ if (bodyLength > (mMaxPacketSize - headerArray.length - 6)) {
returnValue = true;
- bodyLength = maxPacketSize - headerArray.length - 6;
+ bodyLength = mMaxPacketSize - headerArray.length - 6;
}
- byte[] body = privateOutput.readBytes(bodyLength);
+ byte[] body = mPrivateOutput.readBytes(bodyLength);
/*
* Since this is a put request if the final bit is set or
* the output stream is closed we need to send the 0x49
* (End of Body) otherwise, we need to send 0x48 (Body)
*/
- if ((privateOutput.isClosed()) && (!returnValue) && (!isEndOfBodySent)
+ if ((mPrivateOutput.isClosed()) && (!returnValue) && (!mEndOfBodySent)
&& ((type & 0x80) != 0)) {
out.write(0x49);
- isEndOfBodySent = true;
+ mEndOfBodySent = true;
} else {
out.write(0x48);
}
@@ -603,13 +575,13 @@ public final class ClientOperation implements Operation, BaseStream {
}
}
- if (outputStreamOpened && bodyLength <= 0 && !isEndOfBodySent) {
+ if (mPrivateOutputOpen && bodyLength <= 0 && !mEndOfBodySent) {
// only 0x82 or 0x83 can send 0x49
if ((type & 0x80) == 0) {
out.write(0x48);
} else {
out.write(0x49);
- isEndOfBodySent = true;
+ mEndOfBodySent = true;
}
@@ -619,19 +591,19 @@ public final class ClientOperation implements Operation, BaseStream {
}
if (out.size() == 0) {
- if (!parent.sendRequest(type, null, replyHeaders, privateInput)) {
+ if (!mParent.sendRequest(type, null, mReplyHeader, mPrivateInput)) {
return false;
}
return returnValue;
}
if ((out.size() > 0)
- && (!parent.sendRequest(type, out.toByteArray(), replyHeaders, privateInput))) {
+ && (!mParent.sendRequest(type, out.toByteArray(), mReplyHeader, mPrivateInput))) {
return false;
}
// send all of the output data in 0x48,
// send 0x49 with empty body
- if ((privateOutput != null) && (privateOutput.size() > 0))
+ if ((mPrivateOutput != null) && (mPrivateOutput.size() > 0))
returnValue = true;
return returnValue;
@@ -646,41 +618,41 @@ public final class ClientOperation implements Operation, BaseStream {
*/
private synchronized void startProcessing() throws IOException {
- if (privateInput == null) {
- privateInput = new PrivateInputStream(this);
+ if (mPrivateInput == null) {
+ mPrivateInput = new PrivateInputStream(this);
}
boolean more = true;
- if (isGet) {
- if (!isDone) {
- replyHeaders.responseCode = ObexHelper.OBEX_HTTP_CONTINUE;
- while ((more) && (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE)) {
+ if (mGetOperation) {
+ if (!mOperationDone) {
+ mReplyHeader.responseCode = ResponseCodes.OBEX_HTTP_CONTINUE;
+ while ((more) && (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE)) {
more = sendRequest(0x03);
}
- if (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE) {
- parent.sendRequest(0x83, null, replyHeaders, privateInput);
+ if (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE) {
+ mParent.sendRequest(0x83, null, mReplyHeader, mPrivateInput);
}
- if (replyHeaders.responseCode != ObexHelper.OBEX_HTTP_CONTINUE) {
- isDone = true;
+ if (mReplyHeader.responseCode != ResponseCodes.OBEX_HTTP_CONTINUE) {
+ mOperationDone = true;
}
}
} else {
- if (!isDone) {
- replyHeaders.responseCode = ObexHelper.OBEX_HTTP_CONTINUE;
- while ((more) && (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE)) {
+ if (!mOperationDone) {
+ mReplyHeader.responseCode = ResponseCodes.OBEX_HTTP_CONTINUE;
+ while ((more) && (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE)) {
more = sendRequest(0x02);
}
}
- if (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE) {
- parent.sendRequest(0x82, null, replyHeaders, privateInput);
+ if (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE) {
+ mParent.sendRequest(0x82, null, mReplyHeader, mPrivateInput);
}
- if (replyHeaders.responseCode != ObexHelper.OBEX_HTTP_CONTINUE) {
- isDone = true;
+ if (mReplyHeader.responseCode != ResponseCodes.OBEX_HTTP_CONTINUE) {
+ mOperationDone = true;
}
}
}
@@ -697,45 +669,45 @@ public final class ClientOperation implements Operation, BaseStream {
public synchronized boolean continueOperation(boolean sendEmpty, boolean inStream)
throws IOException {
- if (isGet) {
- if ((inStream) && (!isDone)) {
+ if (mGetOperation) {
+ if ((inStream) && (!mOperationDone)) {
// to deal with inputstream in get operation
- parent.sendRequest(0x83, null, replyHeaders, privateInput);
+ mParent.sendRequest(0x83, null, mReplyHeader, mPrivateInput);
/*
* Determine if that was not the last packet in the operation
*/
- if (replyHeaders.responseCode != ObexHelper.OBEX_HTTP_CONTINUE) {
- isDone = true;
+ if (mReplyHeader.responseCode != ResponseCodes.OBEX_HTTP_CONTINUE) {
+ mOperationDone = true;
}
return true;
- } else if ((!inStream) && (!isDone)) {
+ } else if ((!inStream) && (!mOperationDone)) {
// to deal with outputstream in get operation
- if (privateInput == null) {
- privateInput = new PrivateInputStream(this);
+ if (mPrivateInput == null) {
+ mPrivateInput = new PrivateInputStream(this);
}
sendRequest(0x03);
return true;
- } else if (isDone) {
+ } else if (mOperationDone) {
return false;
}
} else {
- if ((!inStream) && (!isDone)) {
+ if ((!inStream) && (!mOperationDone)) {
// to deal with outputstream in put operation
- if (replyHeaders.responseCode == -1) {
- replyHeaders.responseCode = ObexHelper.OBEX_HTTP_CONTINUE;
+ if (mReplyHeader.responseCode == -1) {
+ mReplyHeader.responseCode = ResponseCodes.OBEX_HTTP_CONTINUE;
}
sendRequest(0x02);
return true;
- } else if ((inStream) && (!isDone)) {
+ } else if ((inStream) && (!mOperationDone)) {
// How to deal with inputstream in put operation ?
return false;
- } else if (isDone) {
+ } else if (mOperationDone) {
return false;
}
@@ -752,23 +724,23 @@ public final class ClientOperation implements Operation, BaseStream {
* @throws IOException if an IO error occurs
*/
public void streamClosed(boolean inStream) throws IOException {
- if (!isGet) {
- if ((!inStream) && (!isDone)) {
+ if (!mGetOperation) {
+ if ((!inStream) && (!mOperationDone)) {
// to deal with outputstream in put operation
boolean more = true;
- if ((privateOutput != null) && (privateOutput.size() <= 0)) {
- byte[] headerArray = ObexHelper.createHeader(requestHeaders, false);
+ if ((mPrivateOutput != null) && (mPrivateOutput.size() <= 0)) {
+ byte[] headerArray = ObexHelper.createHeader(mRequestHeader, false);
if (headerArray.length <= 0)
more = false;
}
// If have not sent any data so send all now
- if (replyHeaders.responseCode == -1) {
- replyHeaders.responseCode = ObexHelper.OBEX_HTTP_CONTINUE;
+ if (mReplyHeader.responseCode == -1) {
+ mReplyHeader.responseCode = ResponseCodes.OBEX_HTTP_CONTINUE;
}
- while ((more) && (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE)) {
+ while ((more) && (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE)) {
more = sendRequest(0x02);
}
@@ -777,61 +749,60 @@ public final class ClientOperation implements Operation, BaseStream {
* only have a single reply to send. so we don't need the while
* loop.
*/
- while (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE) {
+ while (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE) {
sendRequest(0x82);
}
- isDone = true;
- } else if ((inStream) && (isDone)) {
+ mOperationDone = true;
+ } else if ((inStream) && (mOperationDone)) {
// how to deal with input stream in put stream ?
- isDone = true;
+ mOperationDone = true;
}
} else {
- isValidateConnected = false;
- if ((inStream) && (!isDone)) {
+ if ((inStream) && (!mOperationDone)) {
// to deal with inputstream in get operation
// Have not sent any data so send it all now
- if (replyHeaders.responseCode == -1) {
- replyHeaders.responseCode = ObexHelper.OBEX_HTTP_CONTINUE;
+ if (mReplyHeader.responseCode == -1) {
+ mReplyHeader.responseCode = ResponseCodes.OBEX_HTTP_CONTINUE;
}
- while (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE) {
+ while (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE) {
if (!sendRequest(0x83)) {
break;
}
}
- while (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE) {
- parent.sendRequest(0x83, null, replyHeaders, privateInput);
+ while (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE) {
+ mParent.sendRequest(0x83, null, mReplyHeader, mPrivateInput);
}
- isDone = true;
- } else if ((!inStream) && (!isDone)) {
+ mOperationDone = true;
+ } else if ((!inStream) && (!mOperationDone)) {
// to deal with outputstream in get operation
// part of the data may have been sent in continueOperation.
boolean more = true;
- if ((privateOutput != null) && (privateOutput.size() <= 0)) {
- byte[] headerArray = ObexHelper.createHeader(requestHeaders, false);
+ if ((mPrivateOutput != null) && (mPrivateOutput.size() <= 0)) {
+ byte[] headerArray = ObexHelper.createHeader(mRequestHeader, false);
if (headerArray.length <= 0)
more = false;
}
- if (privateInput == null) {
- privateInput = new PrivateInputStream(this);
+ if (mPrivateInput == null) {
+ mPrivateInput = new PrivateInputStream(this);
}
- if ((privateOutput != null) && (privateOutput.size() <= 0))
+ if ((mPrivateOutput != null) && (mPrivateOutput.size() <= 0))
more = false;
- replyHeaders.responseCode = ObexHelper.OBEX_HTTP_CONTINUE;
- while ((more) && (replyHeaders.responseCode == ObexHelper.OBEX_HTTP_CONTINUE)) {
+ mReplyHeader.responseCode = ResponseCodes.OBEX_HTTP_CONTINUE;
+ while ((more) && (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE)) {
more = sendRequest(0x03);
}
sendRequest(0x83);
// parent.sendRequest(0x83, null, replyHeaders, privateInput);
- if (replyHeaders.responseCode != ObexHelper.OBEX_HTTP_CONTINUE) {
- isDone = true;
+ if (mReplyHeader.responseCode != ResponseCodes.OBEX_HTTP_CONTINUE) {
+ mOperationDone = true;
}
}