Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid BluetoothSocket not closing
    primarykey
    data
    text
    <p>I have a strange issue that I can't seem to figure out what's going on. I am using the Bluetooth chat example as a base and things work fine for the most part, however, when trying to swtich connections from one UUID to another (two different apps). The hardware closes the connection and opens a new one with the different UUID. </p> <p>The problem is that my bluetooth socket isn't getting closed on the app side. I see these messages in the log:</p> <pre><code>11-20 15:00:44.287: I/BTL_IFC(13313): btl_ifc_ctrl_rx: [BTL_IFC CTRL] recv BTLIF_BTS_RFC_DISC_IND (BTS) 11 pbytes (hdl 47) 11-20 15:00:44.287: I/BLZ20_WRAPPER(13313): btlif_ctrl_callback: btlif_ctrl_callback : msg id BTLIF_BTS_RFC_DISC_IND 11-20 15:00:44.287: I/BLZ20_WRAPPER(13313): btlif_process_disc_ind: disconnect ind status 19, rc chan 8 11-20 15:00:44.287: D/BLZ20_WRAPPER(13313): btlif_signal_event: fd (-1:51), bta 5, rc 8, wflags 0x0, cflags 0x6, port 9053 11-20 15:00:44.287: D/BLZ20_WRAPPER(13313): btlif_signal_event: ### event BTLIF_BTS_RFC_DISC_IND not matched ### 11-20 15:00:44.287: I/BTL_IFC(13313): send_ctrl_msg: [BTL_IFC CTRL] send BTLIF_BTS_RFC_DISC_IND_ACK (BTS) 9 pbytes (hdl 47) </code></pre> <p>So I know it's being disconected, however my socket remains open. I would assume when I try to do this it would give me anI/O exception, but it doesnt.</p> <pre><code>mmInStream.available() </code></pre> <p>It just returns 0 and keeps going. I also monitored the mClosed flag in the BluetoothSocket.java class and it never gets set to true in this case.</p> <p>I'm registered for the the normal dissconnect intents, am I missing one?</p> <pre><code> IntentFilter stateChangeFilter = new IntentFilter("android.bluetooth.adapter.action.STATE_CHANGED"); IntentFilter disconnectFilter1 = new IntentFilter("android.bluetooth.device.action.ACL_DISCONNECTED"); IntentFilter disconnectFilter2 = new IntentFilter("android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED"); registerReceiver(mListenForDisconnect,stateChangeFilter ); registerReceiver(mListenForDisconnect,disconnectFilter1 ); registerReceiver(mListenForDisconnect,disconnectFilter2 ); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload