From fe3807a5b23f54f6539436d71aa0cd931a2b76f0 Mon Sep 17 00:00:00 2001 From: Matthew Xie Date: Thu, 18 Jul 2013 17:31:50 -0700 Subject: Bluetooth MAP profile - sms and mms support initial check-in bug:10116530 Change-Id: I57d022005bcff5bc3e56438a81ac92566f957744 --- obex/javax/obex/ClientOperation.java | 3 +++ obex/javax/obex/HeaderSet.java | 2 ++ obex/javax/obex/Operation.java | 2 ++ obex/javax/obex/ServerOperation.java | 35 +++++++++++++++++++++++++---------- 4 files changed, 32 insertions(+), 10 deletions(-) (limited to 'obex') diff --git a/obex/javax/obex/ClientOperation.java b/obex/javax/obex/ClientOperation.java index 05b498c..294b502 100644 --- a/obex/javax/obex/ClientOperation.java +++ b/obex/javax/obex/ClientOperation.java @@ -723,4 +723,7 @@ public final class ClientOperation implements Operation, BaseStream { } } } + + public void noBodyHeader(){ + } } diff --git a/obex/javax/obex/HeaderSet.java b/obex/javax/obex/HeaderSet.java index b89b707..2b3066f 100644 --- a/obex/javax/obex/HeaderSet.java +++ b/obex/javax/obex/HeaderSet.java @@ -464,6 +464,8 @@ public final class HeaderSet { return mHttpHeader; case WHO: return mWho; + case CONNECTION_ID: + return mConnectionID; case OBJECT_CLASS: return mObjectClass; case APPLICATION_PARAMETER: diff --git a/obex/javax/obex/Operation.java b/obex/javax/obex/Operation.java index 25656ed..5b4d5ace 100644 --- a/obex/javax/obex/Operation.java +++ b/obex/javax/obex/Operation.java @@ -178,4 +178,6 @@ public interface Operation { void close() throws IOException; int getMaxPacketSize(); + + public void noBodyHeader(); } diff --git a/obex/javax/obex/ServerOperation.java b/obex/javax/obex/ServerOperation.java index d1476d2..fc441e0 100644 --- a/obex/javax/obex/ServerOperation.java +++ b/obex/javax/obex/ServerOperation.java @@ -88,6 +88,8 @@ public final class ServerOperation implements Operation, BaseStream { private boolean mHasBody; + private boolean mSendBodyHeader = true; + /** * Creates new ServerOperation * @param p the parent that created this object @@ -364,24 +366,33 @@ public final class ServerOperation implements Operation, BaseStream { * (End of Body) otherwise, we need to send 0x48 (Body) */ if ((finalBitSet) || (mPrivateOutput.isClosed())) { - out.write(0x49); + if(mSendBodyHeader == true) { + out.write(0x49); + bodyLength += 3; + out.write((byte)(bodyLength >> 8)); + out.write((byte)bodyLength); + out.write(body); + } } else { + if(mSendBodyHeader == true) { out.write(0x48); + bodyLength += 3; + out.write((byte)(bodyLength >> 8)); + out.write((byte)bodyLength); + out.write(body); + } } - bodyLength += 3; - out.write((byte)(bodyLength >> 8)); - out.write((byte)bodyLength); - out.write(body); } } if ((finalBitSet) && (type == ResponseCodes.OBEX_HTTP_OK) && (orginalBodyLength <= 0)) { - out.write(0x49); - orginalBodyLength = 3; - out.write((byte)(orginalBodyLength >> 8)); - out.write((byte)orginalBodyLength); - + if(mSendBodyHeader == true) { + out.write(0x49); + orginalBodyLength = 3; + out.write((byte)(orginalBodyLength >> 8)); + out.write((byte)orginalBodyLength); + } } mResponseSize = 3; @@ -711,4 +722,8 @@ public final class ServerOperation implements Operation, BaseStream { public void streamClosed(boolean inStream) throws IOException { } + + public void noBodyHeader(){ + mSendBodyHeader = false; + } } -- cgit v1.1