diff options
author | Hemant Gupta <hemantg@codeaurora.org> | 2015-09-06 19:37:35 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:23:57 -0600 |
commit | 9392eeb8f50cf742eb25c9074caefe84bf24dd8a (patch) | |
tree | f58cd2865ab6a960196c23d7aefacccdae3d885f | |
parent | 66a3f0c874aa4ab81a247a432b0da2bf16e725b3 (diff) | |
download | android_frameworks_opt_bluetooth-9392eeb8f50cf742eb25c9074caefe84bf24dd8a.tar.gz android_frameworks_opt_bluetooth-9392eeb8f50cf742eb25c9074caefe84bf24dd8a.tar.bz2 android_frameworks_opt_bluetooth-9392eeb8f50cf742eb25c9074caefe84bf24dd8a.zip |
PBAP-C: Add support for dynamic SDP record creation
This patch adds support for dynamic creation of PBAP Client SDP
record. Without this patch it is not possible to add pbap client
sdp record when pbap client test application is launched, leading
to BT spec violation and resulting in PTS IOPT test case TP/SDSS/BV-02
to fail.
Change-Id: If5226b633d36eba8e43b472f170d8c8cc360153b
-rw-r--r-- | src/android/bluetooth/client/pbap/BluetoothPbapClient.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/android/bluetooth/client/pbap/BluetoothPbapClient.java b/src/android/bluetooth/client/pbap/BluetoothPbapClient.java index 5e212e8..fdc5950 100644 --- a/src/android/bluetooth/client/pbap/BluetoothPbapClient.java +++ b/src/android/bluetooth/client/pbap/BluetoothPbapClient.java @@ -16,6 +16,7 @@ package android.bluetooth.client.pbap; +import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.os.Handler; import android.os.Message; @@ -378,6 +379,10 @@ public class BluetoothPbapClient { private SessionHandler mSessionHandler; + private static final int SDP_PBAP_PCE_VERSION = 0x0101; + private int mPceSdpHandle = -1;; + private static BluetoothAdapter mAdapter = BluetoothAdapter.getDefaultAdapter(); + private static class SessionHandler extends Handler { private final WeakReference<BluetoothPbapClient> mClient; @@ -516,6 +521,8 @@ public class BluetoothPbapClient { mSessionHandler = new SessionHandler(this); + addSdp(); + mSession = new BluetoothPbapSession(device, mSessionHandler); } @@ -527,6 +534,33 @@ public class BluetoothPbapClient { mSession.start(); } + /** + * Add the SDP record for PBAP Client + */ + public void addSdp() { + Log.d(TAG, "addSdp"); + if(mPceSdpHandle >= 0) { + Log.d(TAG, "Removing PCE SDP record: " + mPceSdpHandle); + mAdapter.removeSdpRecord(mPceSdpHandle); + mPceSdpHandle = -1; + } + mPceSdpHandle = mAdapter.createPbapPceSdpRecord("Phonebook Access Client Service", + SDP_PBAP_PCE_VERSION); + } + + + /** + * removes the SDP record for PBAP Client + */ + public void removeSdp() { + Log.d(TAG, "removeSdp"); + if(mPceSdpHandle >= 0) { + Log.d(TAG, "Removing PCE SDP record: " + mPceSdpHandle); + mAdapter.removeSdpRecord(mPceSdpHandle); + mPceSdpHandle = -1; + } + } + @Override public void finalize() { if (mSession != null) { |