summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmriti Gupta <smritig@codeaurora.org>2014-11-20 10:13:37 +0530
committerHemant Gupta <hemantg@codeaurora.org>2014-11-23 19:05:11 +0530
commit7999129408ce543eebe65d0e0d1d8f44f6ba7303 (patch)
tree8c928304c447fe63839620316bbf81fbc528978b
parent93ab0cc91bc60790507e132333fd6b679734b26a (diff)
downloadandroid_packages_apps_BluetoothExt-7999129408ce543eebe65d0e0d1d8f44f6ba7303.tar.gz
android_packages_apps_BluetoothExt-7999129408ce543eebe65d0e0d1d8f44f6ba7303.tar.bz2
android_packages_apps_BluetoothExt-7999129408ce543eebe65d0e0d1d8f44f6ba7303.zip
SAP: Flush RfcommOutputStream
Flush RfcommOuputStream after every write so that Sap packets could go seperately. It is done since It was leading to queing of packets at rfcomm earlier. CRs-fixed: 760728 Change-Id: I1cc6b5a60ce2c830f4a8bf7f06965e0573aa53b2
-rw-r--r--src/org/codeaurora/bluetooth/sap/BluetoothSapService.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java b/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
index 7ffec37..cd90fad 100644
--- a/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
+++ b/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
@@ -1017,6 +1017,7 @@ public class BluetoothSapService extends Service {
/* Read the SAP request from Rfcomm channel */
NumRead = mRfcommInputStream.read(IpcMsgBuffer.array(), SAP_IPC_MSG_OFF_MSG + TotalRead,
SAP_MAX_MSG_LEN - TotalRead);
+ if (VERBOSE) Log.v(TAG, "NumRead from rfcomm = " + NumRead);
if ( NumRead < 0) {
break;
}
@@ -1134,7 +1135,7 @@ public class BluetoothSapService extends Service {
if (VERBOSE) Log.v(TAG, "Reading the SAP responses from Sapd");
/* Read the SAP responses from SAP server */
NumRead = mSapdInputStream.read(IpcMsgBuffer.array(),0, SAP_MAX_IPC_MSG_LEN);
- if (VERBOSE) Log.v(TAG, "NumRead" + NumRead);
+ if (VERBOSE) Log.v(TAG, "NumRead from sapd = " + NumRead);
if ( NumRead < 0) {
break;
}
@@ -1153,12 +1154,14 @@ public class BluetoothSapService extends Service {
try {
mRfcommOutputStream.write(IpcMsgBuffer.array(), ReadIndex + SAP_IPC_MSG_OFF_MSG,
IpcMsgBuffer.getShort(ReadIndex + SAP_IPC_MSG_OFF_MSG_LEN));
+ mRfcommOutputStream.flush();
} catch (IOException ex) {
stopped = true;
break;
}
if (VERBOSE)
- Log.v(TAG, "DownlinkThread Msg written to Rfcomm");
+ Log.v(TAG, "Length of DownlinkThread Msg written to Rfcomm" +
+ IpcMsgBuffer.getShort(ReadIndex + SAP_IPC_MSG_OFF_MSG_LEN));
}
else if (IpcMsgBuffer.get(ReadIndex + SAP_IPC_MSG_OFF_MSG_TYPE) == SAP_IPC_MSG_CTRL_RESPONSE) {
@@ -1290,8 +1293,10 @@ public class BluetoothSapService extends Service {
IpcMsgBuffer.put(SAP_HEADER_SIZE + SAP_MSG_OFF_PARAM_VAL, CONN_ERR);
try {
- if (mRfcommOutputStream != null)
+ if (mRfcommOutputStream != null) {
mRfcommOutputStream.write(IpcMsgBuffer.array(), 0, WriteLen);
+ mRfcommOutputStream.flush();
+ }
} catch (IOException ex) {
if (VERBOSE) Log.v(TAG, "mRfcommOutputStream wrtie exception: " + ex.toString());
}