Loading src/com/android/bluetooth/map/BluetoothMnsObexClient.java +23 −7 Original line number Diff line number Diff line Loading @@ -261,6 +261,13 @@ public class BluetoothMnsObexClient { int responseCode = -1; HeaderSet request; int maxChunkSize, bytesToWrite, bytesWritten = 0; ClientSession clientSession = mClientSession; if ((!mConnected) || (clientSession == null)) { Log.w(TAG, "sendEvent after disconnect:" + mConnected); return responseCode; } request = new HeaderSet(); BluetoothMapAppParams appParams = new BluetoothMapAppParams(); appParams.setMasInstanceId(masInstanceId); Loading @@ -272,8 +279,12 @@ public class BluetoothMnsObexClient { request.setHeader(HeaderSet.TYPE, TYPE_EVENT); request.setHeader(HeaderSet.APPLICATION_PARAMETER, appParams.EncodeParams()); if (hsConnect.mConnectionID != null) { request.mConnectionID = new byte[4]; System.arraycopy(hsConnect.mConnectionID, 0, request.mConnectionID, 0, 4); } else { Log.w(TAG, "sendEvent: no connection ID"); } synchronized (this) { mWaitingForRemote = true; Loading @@ -281,7 +292,7 @@ public class BluetoothMnsObexClient { // Send the header first and then the body try { if (V) Log.v(TAG, "Send headerset Event "); putOperation = (ClientOperation)mClientSession.put(request); putOperation = (ClientOperation)clientSession.put(request); // TODO - Should this be kept or Removed } catch (IOException e) { Loading Loading @@ -313,10 +324,8 @@ public class BluetoothMnsObexClient { if (bytesWritten == eventBytes.length) { Log.i(TAG, "SendEvent finished send length" + eventBytes.length); outputStream.close(); } else { error = true; outputStream.close(); putOperation.abort(); Log.i(TAG, "SendEvent interrupted"); } Loading @@ -329,7 +338,14 @@ public class BluetoothMnsObexClient { error = true; } finally { try { if (!error) { if (outputStream != null) { outputStream.close(); } } catch (IOException e) { Log.e(TAG, "Error when closing stream after send " + e.getMessage()); } try { if ((!error) && (putOperation != null)) { responseCode = putOperation.getResponseCode(); if (responseCode != -1) { if (V) Log.v(TAG, "Put response code " + responseCode); Loading Loading
src/com/android/bluetooth/map/BluetoothMnsObexClient.java +23 −7 Original line number Diff line number Diff line Loading @@ -261,6 +261,13 @@ public class BluetoothMnsObexClient { int responseCode = -1; HeaderSet request; int maxChunkSize, bytesToWrite, bytesWritten = 0; ClientSession clientSession = mClientSession; if ((!mConnected) || (clientSession == null)) { Log.w(TAG, "sendEvent after disconnect:" + mConnected); return responseCode; } request = new HeaderSet(); BluetoothMapAppParams appParams = new BluetoothMapAppParams(); appParams.setMasInstanceId(masInstanceId); Loading @@ -272,8 +279,12 @@ public class BluetoothMnsObexClient { request.setHeader(HeaderSet.TYPE, TYPE_EVENT); request.setHeader(HeaderSet.APPLICATION_PARAMETER, appParams.EncodeParams()); if (hsConnect.mConnectionID != null) { request.mConnectionID = new byte[4]; System.arraycopy(hsConnect.mConnectionID, 0, request.mConnectionID, 0, 4); } else { Log.w(TAG, "sendEvent: no connection ID"); } synchronized (this) { mWaitingForRemote = true; Loading @@ -281,7 +292,7 @@ public class BluetoothMnsObexClient { // Send the header first and then the body try { if (V) Log.v(TAG, "Send headerset Event "); putOperation = (ClientOperation)mClientSession.put(request); putOperation = (ClientOperation)clientSession.put(request); // TODO - Should this be kept or Removed } catch (IOException e) { Loading Loading @@ -313,10 +324,8 @@ public class BluetoothMnsObexClient { if (bytesWritten == eventBytes.length) { Log.i(TAG, "SendEvent finished send length" + eventBytes.length); outputStream.close(); } else { error = true; outputStream.close(); putOperation.abort(); Log.i(TAG, "SendEvent interrupted"); } Loading @@ -329,7 +338,14 @@ public class BluetoothMnsObexClient { error = true; } finally { try { if (!error) { if (outputStream != null) { outputStream.close(); } } catch (IOException e) { Log.e(TAG, "Error when closing stream after send " + e.getMessage()); } try { if ((!error) && (putOperation != null)) { responseCode = putOperation.getResponseCode(); if (responseCode != -1) { if (V) Log.v(TAG, "Put response code " + responseCode); Loading