我在Android 2.3.6的三星银河笔记上遇到蓝牙SPP的问题-它工作了一段时间,但突然连接终止-在其他手机上可以连续使用.这是发生日志的部分
D/BLZ20_ASOCKWRP(11288): asocket_readI/BLZ20_WRAPPER(11288): blz20_wrp_poll: nfds 2, timeout -1 msD/BLZ20_WRAPPER(11288): blz20_wrp_poll: transp poll : (fd 46) returned r_ev [PolliN ] (0x1)D/BLZ20_WRAPPER(11288): blz20_wrp_poll: return 1D/BLZ20_WRAPPER(11288): blz20_wrp_read: read 43 bytes out of 43 on fd 46D/BLZ20_ASOCKWRP(11288): asocket_writeI/BLZ20_WRAPPER(11288): blz20_wrp_poll: nfds 2, timeout -1 msD/BLZ20_WRAPPER(11288): blz20_wrp_poll: transp poll : (fd 46) returned r_ev [PolLOUT ] (0x4)D/BLZ20_WRAPPER(11288): blz20_wrp_poll: return 1D/BLZ20_WRAPPER(11288): blz20_wrp_write: wrote 10 bytes out of 10 on fd 46I//system/bin/btld(11351): btlif_bts_API_data_cb: btlif_bts_API_data_cb : hdl 35, len 10I//system/bin/btld(11351): bts_alloc_buf: hdr:0x405241a4, max 1712, offset 20, len 0 I//system/bin/btld(11351): bts_alloc_buf: peer mtu 127I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_WRITE_EVTI//system/bin/btld(11351): rfc_setup_rx_buf: pushed in queue p_buf #0: 0x405241a4, len:0, offset:20I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_DATA_IND_EVTI//system/bin/btld(11351): jv_forward_data_to_jni: BTA_JV_RFCOMM_DATA_IND_EVT bta hdl 2I/BluetoothPolicyService( 2767): getBluetoothDataTransferAllowed D/BLZ20_ASOCKWRP(11288): asocket_readI/BLZ20_WRAPPER(11288): blz20_wrp_poll: nfds 2, timeout -1 msD/BLZ20_WRAPPER(11288): blz20_wrp_poll: transp poll : (fd 46) returned r_ev [PolliN ] (0x1)D/BLZ20_WRAPPER(11288): blz20_wrp_poll: return 1D/BLZ20_WRAPPER(11288): blz20_wrp_read: read 9 bytes out of 9 on fd 46I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_DATA_IND_EVTI//system/bin/btld(11351): jv_forward_data_to_jni: BTA_JV_RFCOMM_DATA_IND_EVT bta hdl 2I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_DATA_IND_EVTI//system/bin/btld(11351): jv_forward_data_to_jni: BTA_JV_RFCOMM_DATA_IND_EVT bta hdl 2I/BluetoothPolicyService( 2767): getBluetoothDataTransferAllowed D/BLZ20_ASOCKWRP(11288): asocket_readI/BLZ20_WRAPPER(11288): blz20_wrp_poll: nfds 2, timeout -1 msD/BLZ20_WRAPPER(11288): blz20_wrp_poll: transp poll : (fd 46) returned r_ev [PolliN ] (0x1)D/BLZ20_WRAPPER(11288): blz20_wrp_poll: return 1D/BLZ20_WRAPPER(11288): blz20_wrp_read: read 67 bytes out of 67 on fd 46I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_DATA_IND_EVTI//system/bin/btld(11351): jv_forward_data_to_jni: BTA_JV_RFCOMM_DATA_IND_EVT bta hdl 2I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_DATA_IND_EVTI//system/bin/btld(11351): jv_forward_data_to_jni: BTA_JV_RFCOMM_DATA_IND_EVT bta hdl 2I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_DATA_IND_EVTI//system/bin/btld(11351): jv_forward_data_to_jni: BTA_JV_RFCOMM_DATA_IND_EVT bta hdl 2I/BluetoothPolicyService( 2767): getBluetoothDataTransferAllowed D/BLZ20_ASOCKWRP(11288): asocket_readI/BLZ20_WRAPPER(11288): blz20_wrp_poll: nfds 2, timeout -1 msD/BLZ20_WRAPPER(11288): blz20_wrp_poll: transp poll : (fd 46) returned r_ev [PolliN ] (0x1)D/BLZ20_WRAPPER(11288): blz20_wrp_poll: return 1D/BLZ20_WRAPPER(11288): blz20_wrp_read: read 69 bytes out of 69 on fd 46D/BLZ20_ASOCKWRP(11288): asocket_writeI/BLZ20_WRAPPER(11288): blz20_wrp_poll: nfds 2, timeout -1 msD/BLZ20_WRAPPER(11288): blz20_wrp_poll: transp poll : (fd 46) returned r_ev [PolLOUT ] (0x4)D/BLZ20_WRAPPER(11288): blz20_wrp_poll: return 1D/BLZ20_WRAPPER(11288): blz20_wrp_write: wrote 10 bytes out of 10 on fd 46I//system/bin/btld(11351): btlif_bts_API_data_cb: btlif_bts_API_data_cb : hdl 35, len 10I//system/bin/btld(11351): bts_alloc_buf: hdr:0x405370b0, max 1712, offset 20, len 0 I//system/bin/btld(11351): bts_alloc_buf: peer mtu 127I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_WRITE_EVTI//system/bin/btld(11351): rfc_setup_rx_buf: pushed in queue p_buf #0: 0x405370b0, len:0, offset:20I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_DATA_IND_EVTI//system/bin/btld(11351): jv_forward_data_to_jni: BTA_JV_RFCOMM_DATA_IND_EVT bta hdl 2I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_DATA_IND_EVTI//system/bin/btld(11351): jv_forward_data_to_jni: BTA_JV_RFCOMM_DATA_IND_EVT bta hdl 2I/BluetoothPolicyService( 2767): getBluetoothDataTransferAllowed I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_DATA_IND_EVTI//system/bin/btld(11351): jv_forward_data_to_jni: BTA_JV_RFCOMM_DATA_IND_EVT bta hdl 2D/BLZ20_ASOCKWRP(11288): asocket_readI/BLZ20_WRAPPER(11288): blz20_wrp_poll: nfds 2, timeout -1 msD/BLZ20_WRAPPER(11288): blz20_wrp_poll: transp poll : (fd 46) returned r_ev [PolliN ] (0x1)D/BLZ20_WRAPPER(11288): blz20_wrp_poll: return 1D/BLZ20_WRAPPER(11288): blz20_wrp_read: read 65 bytes out of 65 on fd 46I/BluetoothPolicyService( 2767): getBluetoothDataTransferAllowed I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_DATA_IND_EVTI//system/bin/btld(11351): jv_forward_data_to_jni: BTA_JV_RFCOMM_DATA_IND_EVT bta hdl 2I//system/bin/btld(11351): jw_if_rfcomm_cl_cback: jw_if_rfcomm_cl_cback event=BTA_JV_RFCOMM_DATA_IND_EVTI//system/bin/btld(11351): jv_forward_data_to_jni: BTA_JV_RFCOMM_DATA_IND_EVT bta hdl 2D/BLZ20_ASOCKWRP(11288): asocket_readI/BLZ20_WRAPPER(11288): blz20_wrp_poll: nfds 2, timeout -1 msD/BLZ20_WRAPPER(11288): blz20_wrp_poll: transp poll : (fd 46) returned r_ev [PolliN ] (0x1)D/BLZ20_WRAPPER(11288): blz20_wrp_poll: return 1D/BLZ20_WRAPPER(11288): blz20_wrp_read: read 0 bytes out of 0 on fd 46I/BLZ20_WRAPPER(11288): blz20_wrp_read: connection abortedD/BLZ20_WRAPPER(11288): blz20_wrp_read: set errno 103 (Software caused connection abort) l.1910 D/BLZ20_ASOCKWRP(11288): asocket_abort [46,47,48]I/BLZ20_WRAPPER(11288): blz20_wrp_shutdown: s 46, how 2D/BLZ20_WRAPPER(11288): blz20_wrp_shutdown: fd (-1:46), bta 2, rc 1, wflags 0x800, cflags 0x0, port 9050I/BLZ20_WRAPPER(11288): blz20_wrp_shutdown: shutdown socketD/BLZ20_WRAPPER(11288): blz20_wrp_write: wrote 1 bytes out of 1 on fd 48D/BLZ20_ASOCKWRP(11288): asocket_destroyD/BLZ20_ASOCKWRP(11288): asocket_abort [46,47,48]I/BLZ20_WRAPPER(11288): blz20_wrp_shutdown: s 46, how 2D/BLZ20_WRAPPER(11288): blz20_wrp_shutdown: fd (-1:46), bta 2, rc 1, wflags 0x800, cflags 0x0, port 9050I/BLZ20_WRAPPER(11288): blz20_wrp_shutdown: shutdown socketD/BLZ20_WRAPPER(11288): blz20_wrp_write: wrote 1 bytes out of 1 on fd 48I/BLZ20_WRAPPER(11288): blz20_wrp_close: s 48D/BLZ20_WRAPPER(11288): blz20_wrp_close: std close (48)I/BLZ20_WRAPPER(11288): blz20_wrp_close: s 47D/BLZ20_WRAPPER(11288): blz20_wrp_close: std close (47)I/BLZ20_WRAPPER(11288): blz20_wrp_close: s 46D/BLZ20_WRAPPER(11288): blz20_wrp_close: fd (-1:46), bta 2, rc 1, wflags 0x800, cflags 0x0, port 9050
解决方法:
问题是我在没有可用数据的情况下经常进行后续的读取调用.虽然这在大多数手机上都可以正常工作(read仅返回读取的0字节)-在某些Samsung手机上却无法实现-一种解决方案是在进行读取之前通过available()检查是否确实有可用数据.
总结以上是内存溢出为你收集整理的android-与2.3.6的银河笔记上的蓝牙SPP全部内容,希望文章能够帮你解决android-与2.3.6的银河笔记上的蓝牙SPP所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)