summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasper Bonde <c.bonde@samsung.com>2015-04-09 09:28:50 +0200
committerCasper Bonde <c.bonde@samsung.com>2015-04-09 10:42:01 +0000
commit3920adcb7724bb0be6c81e51371219c63e9403ea (patch)
tree38a1ce57ce35153a8e9e29c0d0351a9f691db131
parent192d793d2586b620027edd5b45ff4c72a86cc7be (diff)
downloadbluetooth-3920adcb7724bb0be6c81e51371219c63e9403ea.tar.gz
Update to new OBEX transport and SDP search
The fetchMasInstances() search API have been replaced with a more generic sdpSearch(UUID) API, and therefore the constructor of BluetoothMasClient should take in a SdpMasRecord in stead of a BluetoothMasInstance. Any app using this library must use the new sdpSearch API and listen for the new ACTION_SDP_RECORD intent. Change-Id: I4a9a097fc05e227f606b8eb127a2762ec595cbab Signed-off-by: Casper Bonde <c.bonde@samsung.com>
-rw-r--r--src/android/bluetooth/client/map/BluetoothMapRfcommTransport.java15
-rw-r--r--src/android/bluetooth/client/map/BluetoothMasClient.java19
-rw-r--r--src/android/bluetooth/client/pbap/BluetoothPbapObexTransport.java15
3 files changed, 41 insertions, 8 deletions
diff --git a/src/android/bluetooth/client/map/BluetoothMapRfcommTransport.java b/src/android/bluetooth/client/map/BluetoothMapRfcommTransport.java
index 0b1b624..5bec982 100644
--- a/src/android/bluetooth/client/map/BluetoothMapRfcommTransport.java
+++ b/src/android/bluetooth/client/map/BluetoothMapRfcommTransport.java
@@ -74,4 +74,19 @@ class BluetoothMapRfcommTransport implements ObexTransport {
public DataOutputStream openDataOutputStream() throws IOException {
return new DataOutputStream(openOutputStream());
}
+
+ @Override
+ public int getMaxTransmitPacketSize() {
+ return -1;
+ }
+
+ @Override
+ public int getMaxReceivePacketSize() {
+ return -1;
+ }
+
+ @Override
+ public boolean isSrmSupported() {
+ return false;
+ }
}
diff --git a/src/android/bluetooth/client/map/BluetoothMasClient.java b/src/android/bluetooth/client/map/BluetoothMasClient.java
index 7d50e5b..d6d2a1c 100644
--- a/src/android/bluetooth/client/map/BluetoothMasClient.java
+++ b/src/android/bluetooth/client/map/BluetoothMasClient.java
@@ -19,6 +19,7 @@ package android.bluetooth.client.map;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothMasInstance;
import android.bluetooth.BluetoothSocket;
+import android.bluetooth.SdpMasRecord;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
@@ -284,7 +285,7 @@ public class BluetoothMasClient {
private final BluetoothDevice mDevice;
/** MAS instance associated with client */
- private final BluetoothMasInstance mMas;
+ private final SdpMasRecord mMas;
/** callback handler to application */
private final Handler mCallback;
@@ -453,9 +454,11 @@ public class BluetoothMasClient {
private void sendToClient(int event, boolean success, Object param) {
if (success) {
- mCallback.obtainMessage(event, STATUS_OK, mMas.getId(), param).sendToTarget();
+ mCallback.obtainMessage(event, STATUS_OK, mMas.getMasInstanceId(), param)
+ .sendToTarget();
} else {
- mCallback.obtainMessage(event, STATUS_FAILED, mMas.getId(), null).sendToTarget();
+ mCallback.obtainMessage(event, STATUS_FAILED, mMas.getMasInstanceId(), null)
+ .sendToTarget();
}
}
@@ -469,7 +472,7 @@ public class BluetoothMasClient {
@Override
public void run() {
try {
- socket = mDevice.createRfcommSocket(mMas.getChannel());
+ socket = mDevice.createRfcommSocket(mMas.getRfcommCannelNumber());
socket.connect();
BluetoothMapRfcommTransport transport;
@@ -586,7 +589,7 @@ public class BluetoothMasClient {
* <code>arg2</code> to MAS instance ID. <code>obj</code> in
* message is event specific.
*/
- public BluetoothMasClient(BluetoothDevice device, BluetoothMasInstance mas,
+ public BluetoothMasClient(BluetoothDevice device, SdpMasRecord mas,
Handler callback) {
mDevice = device;
mMas = mas;
@@ -600,7 +603,7 @@ public class BluetoothMasClient {
*
* @return instance data object
*/
- public BluetoothMasInstance getInstanceData() {
+ public SdpMasRecord getInstanceData() {
return mMas;
}
@@ -665,7 +668,7 @@ public class BluetoothMasClient {
mMnsService = new BluetoothMnsService();
}
- mMnsService.registerCallback(mMas.getId(), mSessionHandler);
+ mMnsService.registerCallback(mMas.getMasInstanceId(), mSessionHandler);
BluetoothMasRequest request = new BluetoothMasRequestSetNotificationRegistration(true);
return mObexSession.makeRequest(request);
@@ -675,7 +678,7 @@ public class BluetoothMasClient {
Log.v(TAG, "enableNotifications()");
if (mMnsService != null) {
- mMnsService.unregisterCallback(mMas.getId());
+ mMnsService.unregisterCallback(mMas.getMasInstanceId());
}
mMnsService = null;
diff --git a/src/android/bluetooth/client/pbap/BluetoothPbapObexTransport.java b/src/android/bluetooth/client/pbap/BluetoothPbapObexTransport.java
index 98fd9db..674c66f 100644
--- a/src/android/bluetooth/client/pbap/BluetoothPbapObexTransport.java
+++ b/src/android/bluetooth/client/pbap/BluetoothPbapObexTransport.java
@@ -80,4 +80,19 @@ class BluetoothPbapObexTransport implements ObexTransport {
// return true;
return mSocket.isConnected();
}
+
+ @Override
+ public int getMaxTransmitPacketSize() {
+ return -1;
+ }
+
+ @Override
+ public int getMaxReceivePacketSize() {
+ return -1;
+ }
+
+ @Override
+ public boolean isSrmSupported() {
+ return false;
+ }
}