Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ported: Bluetooth Message Access Profile (MAP) from CM9

This was added to CM10 to restore message exchange capabilities with automotive systems.

Change-Id: Ib872bebc5c292b1f84c903b068e59b7eeca6d76f
  • Loading branch information...
commit 0e5fdcffdd1c3f1292a7cfa04660c966f70c883a 1 parent d39a1f8
@cgarst cgarst authored rmcc committed
View
14 core/java/android/bluetooth/BluetoothUuid.java
@@ -56,6 +56,10 @@
ParcelUuid.fromString("00001105-0000-1000-8000-00805f9b34fb");
public static final ParcelUuid Hid =
ParcelUuid.fromString("00001124-0000-1000-8000-00805f9b34fb");
+ public static final ParcelUuid MessageAccessServer =
+ ParcelUuid.fromString("00001132-0000-1000-8000-00805f9b34fb");
+ public static final ParcelUuid MessageNotificationServer =
+ ParcelUuid.fromString("00001133-0000-1000-8000-00805f9b34fb");
public static final ParcelUuid PANU =
ParcelUuid.fromString("00001115-0000-1000-8000-00805F9B34FB");
public static final ParcelUuid NAP =
@@ -67,7 +71,7 @@
public static final ParcelUuid[] RESERVED_UUIDS = {
AudioSink, AudioSource, AdvAudioDist, HSP, Handsfree, AvrcpController, AvrcpTarget,
- ObexObjectPush, PANU, NAP};
+ ObexObjectPush, MessageAccessServer, MessageNotificationServer, PANU, NAP};
public static boolean isAudioSource(ParcelUuid uuid) {
return uuid.equals(AudioSource);
@@ -131,6 +135,14 @@ public static boolean isUuidPresent(ParcelUuid[] uuidArray, ParcelUuid uuid) {
return false;
}
+ public static boolean isMessageAccessServer(ParcelUuid uuid) {
+ return uuid.equals(MessageAccessServer);
+ }
+
+ public static boolean isMessageNotificationServer(ParcelUuid uuid) {
+ return uuid.equals(MessageNotificationServer);
+ }
+
/**
* Returns true if there any common ParcelUuids in uuidA and uuidB.
*
View
12 obex/javax/obex/ClientOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008-2009, Motorola, Inc.
+ * Copyright (c) 2010-2011, Motorola, Inc.
*
* All rights reserved.
*
@@ -121,6 +121,12 @@ public ClientOperation(int maxSize, ClientSession p, HeaderSet header, boolean t
(header).mAuthResp.length);
}
+ if ((header).mConnectionID != null) {
+ mRequestHeader.mConnectionID = new byte[4];
+ System.arraycopy((header).mConnectionID, 0, mRequestHeader.mConnectionID, 0,
+ 4);
+
+ }
}
/**
@@ -723,4 +729,8 @@ public void streamClosed(boolean inStream) throws IOException {
}
}
}
+
+ public void noEndofBody() {
+
+ }
}
View
2  obex/javax/obex/Operation.java
@@ -175,6 +175,8 @@
DataOutputStream openDataOutputStream() throws IOException;
+ void noEndofBody();
+
void close() throws IOException;
int getMaxPacketSize();
View
36 obex/javax/obex/ServerOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008-2009, Motorola, Inc.
+ * Copyright (c) 2010-2011, Motorola, Inc.
*
* All rights reserved.
*
@@ -88,6 +88,8 @@
private boolean mHasBody;
+ private boolean mEndofBody = true;
+
/**
* Creates new ServerOperation
* @param p the parent that created this object
@@ -364,24 +366,31 @@ public synchronized boolean sendReply(int type) throws IOException {
* (End of Body) otherwise, we need to send 0x48 (Body)
*/
if ((finalBitSet) || (mPrivateOutput.isClosed())) {
- out.write(0x49);
+ if (mEndofBody) {
+ out.write((byte)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);
}
- 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 (mEndofBody) {
+ out.write(0x49);
+ orginalBodyLength = 3;
+ out.write((byte)(orginalBodyLength >> 8));
+ out.write((byte)orginalBodyLength);
+ }
}
mResponseSize = 3;
@@ -711,4 +720,9 @@ public void ensureNotDone() throws IOException {
public void streamClosed(boolean inStream) throws IOException {
}
+
+ public void noEndofBody() {
+ mEndofBody = false;
+ }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.