summaryrefslogtreecommitdiffstats
path: root/core/java/android/bluetooth/BluetoothAdapter.java
diff options
context:
space:
mode:
authorNitin Shivpure <nshivpur@codeaurora.org>2015-07-20 13:22:28 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:26:45 -0600
commit86020e9a599c3ceaef2a7dc9c744918e9b7f1ce4 (patch)
tree5c8a5d519c8ac4d7d07b089ceeaf6cca4854a5fb /core/java/android/bluetooth/BluetoothAdapter.java
parenta63a2505e74e6955d54629c488699c7f9c52cf18 (diff)
downloadframeworks_base-86020e9a599c3ceaef2a7dc9c744918e9b7f1ce4.zip
frameworks_base-86020e9a599c3ceaef2a7dc9c744918e9b7f1ce4.tar.gz
frameworks_base-86020e9a599c3ceaef2a7dc9c744918e9b7f1ce4.tar.bz2
Bluetooth: Add support for Map client over L2cap
- Adding the support for Map client(MAP1.2). - Add support to create & remove MNS sdp records. - Add support to enable & disable srm, Fews Message Access Profile opreations don't require SRM header in their pdu. Eg. UpdateInbox, SetMessageStatus. SetNotificationRegistration. - If obex based profile explicitly sets GET with final flag, then GET should always be sent as single packet request with final flag set. Change-Id: I89f51ecf8b7834f0b131d043a5f49811914e9635 CRs-Fixed: 754956
Diffstat (limited to 'core/java/android/bluetooth/BluetoothAdapter.java')
-rw-r--r--core/java/android/bluetooth/BluetoothAdapter.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 05dfacd..70f478a 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -1784,6 +1784,60 @@ public final class BluetoothAdapter {
}
/**
+ * Create a client side Message Access Profile Service Record.
+ * Create the record once, and reuse it for all connections.
+ * If changes to a record is needed remove the old record using {@link removeSdpRecord}
+ * and then create a new one.
+ * WARNING: This API requires removeSdpRecord() to be called, to avoid leaking resources!
+ * A second call to this function - either from two different apps or from the
+ * same app, without first calling removeSdpRecord() - will make the device
+ * break the Bluetooth spec, which could lead to severe IOP issues.
+ * @param serviceName The textual name of the service
+ * @param rfcommChannel The RFCOMM channel that clients can connect to
+ * (obtain from BluetoothServerSocket)
+ * @param l2capPsm The L2CAP PSM channel that clients can connect to
+ * (obtain from BluetoothServerSocket)
+ * Supply -1 to omit the L2CAP PSM from the record.
+ * @param version The Profile version number (As specified in the Bluetooth
+ * MAP specification)
+ * @param features The feature bit mask (As specified in the Bluetooth
+ * MAP specification)
+ * @return a handle to the record created. The record can be removed again
+ * using {@link removeSdpRecord}(). The record is not linked to the
+ * creation/destruction of BluetoothSockets, hence SDP record cleanup
+ * is a separate process.
+ * returns -1 if an error occure and the record was not created.
+ * @hide
+ */
+ public int createMapMnsSdpRecord(String serviceName, int rfcommChannel,
+ int l2capPsm, int version, int features) {
+ try {
+ return mService.createMapMnsSdpRecord(serviceName, rfcommChannel,
+ l2capPsm, version, features);
+ } catch (RemoteException e) {
+ Log.e(TAG, "createMapMnsSdpRecord: ", e);
+ }
+ return -1;
+ }
+
+ /**
+ * Remove a SDP record created using createSdpRecord().
+ * This function shall be called before a new call to createSdpRecord for the same record
+ * type can be made, unless the record type created supports multiple instances.
+ * @param recordHandle handle of the record to remove - provided by createSdpRecord()
+ * @return true if success
+ * @hide
+ */
+ public boolean removeSdpRecord(int recordHandle){
+ try {
+ return mService.removeSdpRecord(recordHandle);
+ } catch (RemoteException e) {
+ Log.e(TAG, "createMapMnsSdpRecord: ", e);
+ }
+ return false;
+ }
+
+ /**
* Read the local Out of Band Pairing Data
* <p>Requires {@link android.Manifest.permission#BLUETOOTH}
*