开发者

Android to Bluetooth Device (WT-11) communication/connecting

So we've got an android application that's supposed to pair with a Bluegiga WT-11 bluetooth module, then listen on a server socket for connections from the device. We're using SPP and RFCOMM for the communication with the "well known" UUID 00001101-0000-1000-8000-00805F9B34FB. The pairing is working ok, but accepting connections on the server socket (created using listenUsingRfcommWithServiceRecord() then waiting on accept()) isn't working reliably. It does work some of the time, but it will stop working all together at times, or just work intermittently at other times.

What's most confusing is that the phone seems to be getting the connection from the device, spitting out a few lines to the LogCat, then ignoring the connection altogether; the device thinks the connection failed and the application never gets any connection on the accept().

Here's the LogCat when the phone (Galaxy S II) gets a connection but doesn't do anything with it (I've tried this on a few phones now, let me know if you need logs from other phones or the log from a successful connection):

10-05 05:13:14.25开发者_StackOverflow5: DEBUG/(3341): >>> START GKI_timer_update(), wake_lock_count:3
10-05 05:13:14.255: DEBUG/(3341): >>> RESTARTED GKI_timer_update(): run_cond: 1
10-05 05:13:14.430: WARN/(3341): info:x10
10-05 05:13:14.430: INFO/DTUN_CLNT(3492): dtun-rx signal [DTUN_SIG_DM_LINK_UP] (id 51) len 12
10-05 05:13:14.430: DEBUG/DTUN_HCID4(3492):         dtun_dm_sig_link_up()
10-05 05:13:14.430: INFO/DTUN_HCID4(3492): dtun_dm_sig_link_up: dummy_handle = 375
10-05 05:13:14.435: ERROR/BluetoothEventLoop.cpp(2785): event_filter: Received signal     org.bluez.Device:PropertyChanged from /org/bluez/3492/hci0/dev_00_07_80_4D_B8_E7
10-05 05:13:14.445: INFO//system/bin/btld(3339): send_ctrl_msg: [BTL_IFS CTRL] send     BTLIF_DTUN_SIGNAL_EVT (CTRL) 10 pbytes (hdl 28)
10-05 05:13:14.530: WARN/(3341): amp_find_llcb_by_cid search for CID:0x0040 entry LCID:0x0000 in use 0 CID:0x0001
10-05 05:13:14.910: WARN/(3341): BTA_DM_LINK_DOWN_EVT::bdaddr 00:07:80:4d:b8:e7 reason x13
10-05 05:13:14.910: INFO/DTUN_CLNT(3492): dtun-rx signal [DTUN_SIG_DM_LINK_DOWN] (id 49) len 13
10-05 05:13:14.910: DEBUG/DTUN_HCID4(3492):         dtun_dm_sig_link_down()
10-05 05:13:14.910: INFO/DTUN_HCID4(3492): dtun_dm_sig_link_down device = 0x11c18  handle = 375 reason = 19
10-05 05:13:14.915: ERROR/BluetoothEventLoop.cpp(2785): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/3492/hci0/dev_00_07_80_4D_B8_E7
10-05 05:13:14.915: INFO//system/bin/btld(3339): send_ctrl_msg: [BTL_IFS CTRL] send BTLIF_DTUN_SIGNAL_EVT (CTRL) 11 pbytes (hdl 28)
10-05 05:13:14.930: INFO/BluetoothHIDService(2785): Received intent Intent { act=android.bluetooth.device.action.ACL_DISCONNECTED (has extras) }, device = 00:07:80:4D:B8:E7
10-05 05:13:14.930: INFO/BluetoothHIDService(2785):     ...ACL disconnected
10-05 05:13:15.865: DEBUG/BatteryService(2785): update start
10-05 05:13:15.870: ERROR/BatteryService(2785): TMU status = 0
10-05 05:13:15.870: DEBUG/BatteryService(2785): updateBattery level:97 scale:100 status:2 health:2 present:true voltage: 4176 temperature: 270 technology: Li-ion AC powered:false USB powered:true icon:17302229
10-05 05:13:15.895: INFO/StatusBarPolicy(2903): BAT. S:2 H:2
10-05 05:13:16.165: DEBUG/(3341): >>> STOP GKI_timer_update(), wake_lock_count:2
10-05 05:13:16.165: DEBUG/(3341): >>> SUSPENDED GKI_timer_update()

@WBAN Could you help out with this at all? I see you've done something quite similar.

Any help would be greatly appreciated!

Thanks!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜