Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef234efe authored by Ashwini Munigala's avatar Ashwini Munigala Committed by Steve Kondik
Browse files

MAP: Support MAP Server role on Bluedroid with javax.OBEX lib.

Handle No END OF BODY for MAP 1.0 Server Get request. Only the
last packet need send the 0x49(End of Body). For intermediate
packets, we need to send 0x48 (Body).

Move definitions for MAP or FTP Service Specific UUID and
Request type for CONNECTION_ACCESS_REQUEST intent to
BluetoothExt APK.

Change-Id: I04cfeb8d53b8f8c19160a2de1eb448a7ec1f2c41
CRs-fixed: 504042
parent 08adbb82
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2009, Motorola, Inc.
 *
 * All rights reserved.
@@ -723,4 +724,7 @@ public final class ClientOperation implements Operation, BaseStream {
            }
        }
    }
    public void noEndofBody() {

    }
}
+12 −4
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2009, Motorola, Inc.
 *
 * All rights reserved.
@@ -62,6 +63,7 @@ public final class ClientSession extends ObexSession {

    private final OutputStream mOutput;

    private long mTotalSize = 0;
    public ClientSession(final ObexTransport trans) throws IOException {
        mInput = trans.openInputStream();
        mOutput = trans.openOutputStream();
@@ -479,6 +481,12 @@ public final class ClientSession extends ObexSession {
                byte[] body = ObexHelper.updateHeaderSet(header, data);
                if ((privateInput != null) && (body != null)) {
                    privateInput.writeBytes(body, 1);
                    mTotalSize += (long)(body.length - 1);
                    if((body[0] == HeaderSet.END_OF_BODY) &&
                                            (header.getHeader(HeaderSet.LENGTH) == null)){
                        header.setHeader(HeaderSet.LENGTH, mTotalSize);
                        mTotalSize = 0;
                    }
                }

            if (header.mConnectionID != null) {
+3 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2009, Motorola, Inc.
 *
 * All rights reserved.
@@ -177,5 +178,7 @@ public interface Operation {

    void close() throws IOException;

    void noEndofBody();

    int getMaxPacketSize();
}
+27 −16
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2009, Motorola, Inc.
 *
 * All rights reserved.
@@ -88,6 +89,7 @@ public final class ServerOperation implements Operation, BaseStream {

    private boolean mHasBody;

    private boolean mEndofBody = true;
    /**
     * Creates new ServerOperation
     * @param p the parent that created this object
@@ -364,26 +366,31 @@ public final class ServerOperation implements Operation, BaseStream {
                 * (End of Body) otherwise, we need to send 0x48 (Body)
                 */
                if ((finalBitSet) || (mPrivateOutput.isClosed())) {
                    if (mEndofBody) {
                        out.write(0x49);
                        bodyLength += 3;
                        out.write((byte)(bodyLength >> 8));
                        out.write((byte)bodyLength);
                        out.write(body);
                    }
                } else {
                    out.write(0x48);
                }

                    bodyLength += 3;
                    out.write((byte)(bodyLength >> 8));
                    out.write((byte)bodyLength);
                    out.write(body);
                }
            }
        }

            if ((finalBitSet) && (type == ResponseCodes.OBEX_HTTP_OK) && (orginalBodyLength <= 0)) {
                if (mEndofBody) {
                    out.write(0x49);
                    orginalBodyLength = 3;
                    out.write((byte)(orginalBodyLength >> 8));
                    out.write((byte)orginalBodyLength);

                }

            }
            mResponseSize = 3;
            mParent.sendResponse(type, out.toByteArray());

@@ -711,4 +718,8 @@ public final class ServerOperation implements Operation, BaseStream {
    public void streamClosed(boolean inStream) throws IOException {

    }

    public void noEndofBody() {
        mEndofBody = false;
    }
}