@moderator please excuse my first mail, I hit the wrong button. Hi everybody,
I'm trying for hours and couldn't find an answer anywhere online nor in my Logs. I'm trying to establisch an RFCOMM Link by Bluetooth between an external Device that implements the SPP 1.04 Profile. Here is the output from sdptool: sudo sdptool browse Inquiring ... Browsing 00:0B:0D:8E:D4:33 ... Service Name: SPP slave Service Description: Bluetooth SPP V1.04 Service RecHandle: 0x10000 Service Class ID List: "Serial Port" (0x1101) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 1 Language Base Attr List: code_ISO639: 0x656e encoding: 0x6a base_offset: 0x100 The Device just provides this and doesn't have any input or screen. And it does work with Linux etc. I'm using the following Code in order to establish an Connection: UUID is set to SSDP UUID (16bit UUID = 00001101) private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); private static String address = "00:0B:0D:8E:D4:33"; This happens in onCreate(): mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); Then in onResume: //Starting an discovery mBluetoothAdapter.startDiscovery(); //getting the device BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address); Log.e(TAG, device.getName() + " connected"); //establishing socket try { btSocket = device.createRfcommSocketToServiceRecord(MY_UUID); } catch (IOException e) { Log.e(TAG, "ON RESUME: Socket creation failed.", e); } Log.e(TAG, "TRYING TO CONNECT"); //Connecting the socket try { btSocket.connect(); Log .e(TAG,"ON RESUME: BT connection established, data transfer link open."); } catch (IOException e) { //handling of Exception output etc. } If I look at the dump, everything works until I try to connect to the socket and I don't understand why it isn't working after that. Here ist the dump Look for the TAG ThinBTClient for Log Output. E/THINBTCLIENT( 5991): +++ ON CREATE +++ E/THINBTCLIENT( 5991): +++ DONE IN ON CREATE, GOT LOCAL BT ADAPTER +++ E/THINBTCLIENT( 5991): ++ ON START ++ E/THINBTCLIENT( 5991): + ON RESUME + E/THINBTCLIENT( 5991): + ABOUT TO ATTEMPT CLIENT CONNECT + I/DTUN_CLNT( 2155): Client calling DTUN_METHOD_DM_START_DISCOVERY (id 2) I/ ( 2140): DTUN_ReceiveCtrlMsg: [DTUN] Received message [BTLIF_DTUN_METHOD_CALL] 4354 I/ ( 2140): handle_method_call: handle_method_call :: received DTUN_METHOD_DM_START_DISCOVERY (id 2), len 0 W/BTLD ( 2140): bta_dm_check_av:0 I/BTL-IFS ( 2140): send_ctrl_msg: [BTL_IFS CTRL] send BTLIF_DTUN_SIGNAL_EVT (CTRL) 4 pbytes (hdl 10) I/ADAPTER ( 2155): Discovery session 0xc7b8 with :1.0 activated D/ADAPTER ( 2155): session_ref(0xc7b8): ref=1 I/DTUN_CLNT( 2155): dtun-rx signal [DTUN_SIG_DM_DISCOVERY_STARTED] (id 38) len 6 D/DTUN_HCID( 2155): dtun_dm_sig_discovery_started() I//system/bin/btld( 2139): btapp_dm_DiscoverDevices() I/BluetoothEventLoop.cpp( 1908): event_filter: Received signal org.bluez.Adapter:PropertyChanged from /org/bluez/2155/hci0 E/THINBTCLIENT( 5991): BT GPS connected D/BluetoothSocket( 5991): BluetoothSocket created fd: -1uuid00001101-0000-1000-8000-00805f9b34fbport -1 D/BluetoothSocket.cpp( 5991): initSocketNative I/BLZ20_WRAPPER( 5991): blz20_wrp_socket: fam 31, type 1, prot BTPROTO_RFCOMM D/BTL_IFC_WRP( 5991): wrp_wsock_create: (null) D/BTL_IFC_WRP( 5991): wrp_alloc_new_sock: wrp_alloc_new_sock sub 15 D/BTL_IFC_WRP( 5991): wrp_wsock_create: 31 D/BLZ20_WRAPPER( 5991): btsk_alloc_add: success D/BLZ20_WRAPPER( 5991): btsk_dump_list: fd (-1:28), bta -1, rc 0, wflags 0x0 I/BLZ20_WRAPPER( 5991): blz20_wrp_socket: return 31 D/BLZ20_WRAPPER( 5991): blz20_wrp_setsockopt: fd (-1:31), bta -1, rc 0, wflags 0x0 I/BLZ20_WRAPPER( 5991): blz20_wrp_setsockopt: configure rfcomm lm mode 0x26, (master:0, auth 1, enc 1) I/BLZ20_WRAPPER( 5991): blz20_wrp_setsockopt: success D/BLZ20_WRAPPER( 5991): blz20_wrp_setsockopt: fd (-1:31), bta -1, rc 0, wflags 0x0 I/BLZ20_WRAPPER( 5991): blz20_wrp_setsockopt: configure rfcomm sndbuf len 71680 bytes I/BLZ20_WRAPPER( 5991): blz20_wrp_setsockopt: success D/BluetoothSocket.cpp( 5991): ...fd 31 created (RFCOMM, lm = 26) D/BluetoothSocket.cpp( 5991): initSocketFromFdNative E/THINBTCLIENT( 5991): TRYING TO CONNECT D/BluetoothSocket( 5991): connect D/BluetoothSocket( 5991): doSdp I/BluetoothService.cpp( 1908): ... Object Path = /org/bluez/2155/hci0/ dev_00_0B_0D_8E_D4_33 I/BluetoothService.cpp( 1908): ... Pattern = 00001101-0000-1000-8000-00805f9b34fb, strlen = 36 D/DEVICE ( 2155): *************DiscoverServices******** I/DTUN_HCID( 2155): dtun_client_get_remote_svc_channel: starting discovery on (uuid16=0x0011) I/DTUN_HCID( 2155): bdaddr=00:0B:0D:8E:D4:33 I/DTUN_CLNT( 2155): Client calling DTUN_METHOD_DM_GET_REMOTE_SERVICE_CHANNEL (id 4) I/ ( 2140): DTUN_ReceiveCtrlMsg: [DTUN] Received message [BTLIF_DTUN_METHOD_CALL] 4354 I/ ( 2140): handle_method_call: handle_method_call :: received DTUN_METHOD_DM_GET_REMOTE_SERVICE_CHANNEL (id 4), len 134 E/BTLD ( 2140): ****************search UUID = 1101*********** I//system/bin/btld( 2139): btapp_dm_GetRemoteServiceChannel() I//system/bin/btld( 2139): btapp_dm_GetRemoteServiceChannel() D/WynexActivity( 2003): ----> onWindowFocusChanged(false) D/Wynex ( 2003): ----> OnWindowFocusChanged() W/BTLD ( 2140): ccb timer ticks: 2147483648 W/BTLD ( 2140): info:x0 I/BTL-IFS ( 2140): send_ctrl_msg: [BTL_IFS CTRL] send BTLIF_DTUN_SIGNAL_EVT (CTRL) 10 pbytes (hdl 10) I/DTUN_CLNT( 2155): dtun-rx signal [DTUN_SIG_DM_LINK_UP] (id 49) len 12 D/DTUN_HCID( 2155): dtun_dm_sig_link_up() I/DTUN_HCID( 2155): dtun_dm_sig_link_up: dummy_handle = 266 D/ADAPTER ( 2155): adapter_get_device(00:0B:0D:8E:D4:33) I/DBUS-HCI( 2155): hcid_dbus_conn_complete: adding device = 0xf9f0 handle = 266 I/ADAPTER ( 2155): adapter_add_connection: adding device = 0xf9f0 handle = 266 I/BluetoothEventLoop.cpp( 1908): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/2155/hci0/ dev_00_0B_0D_8E_D4_33 D/BluetoothEventLoop( 1908): Device property changed:00:0B:0D: 8E:D4:33property:Connected W/BTLD ( 2140): process_service_search_attr_rsp I/BTL-IFS ( 2140): send_ctrl_msg: [BTL_IFS CTRL] send BTLIF_DTUN_SIGNAL_EVT (CTRL) 13 pbytes (hdl 10) I/BTL-IFS ( 2140): send_ctrl_msg: [BTL_IFS CTRL] send BTLIF_DTUN_SIGNAL_EVT (CTRL) 4 pbytes (hdl 10) W/BTLD ( 2140): bta_dm_check_av:0 I/DTUN_CLNT( 2155): dtun-rx signal [DTUN_SIG_DM_RMT_SERVICE_CHANNEL] (id 42) len 15 I/DTUN_HCID( 2155): dtun_dm_sig_rmt_service_channel: success=0, service=00000000 E/DTUN_HCID( 2155): discovery unsuccessful! I/DTUN_CLNT( 2155): dtun-rx signal [DTUN_SIG_DM_DISCOVERY_STARTED] (id 38) len 6 D/DTUN_HCID( 2155): dtun_dm_sig_discovery_started() I//system/bin/btld( 2139): btapp_dm_DiscoverDevices() D/WynexIntentService( 2003): Action=android.intent.action.CONFIGURATION_CHANGED I/BluetoothService( 1908): ACL connected, mAclLinkCount = 1 D/BluetoothA2dpService( 1908): Received intent Intent { act=android.bluetooth.device.action.ACL_CONNECTED (has extras) } D/BluetoothA2dpService( 1908): [KJH] device - 00:0B:0D:8E:D4:33, SinkPriority - 0, isSinkDevice - false, aclCount - 1 D/WifiService( 1908): ACTION_BATTERY_CHANGED pluggedType: 2 I/BTL-IFS ( 2140): send_ctrl_msg: [BTL_IFS CTRL] send BTLIF_DTUN_SIGNAL_EVT (CTRL) 11 pbytes (hdl 10) I/DTUN_CLNT( 2155): dtun-rx signal [DTUN_SIG_DM_LINK_DOWN] (id 47) len 13 I/DTUN_HCID( 2155): *** sig_link_down :: device = [0xf9f0] handle = [266] addr = [00:0B:0D:8E:D4:33] reason = [16] *** I/DTUN_HCID( 2155): I/BluetoothEventLoop.cpp( 1908): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/2155/hci0/ dev_00_0B_0D_8E_D4_33 D/BluetoothEventLoop( 1908): Device property changed:00:0B:0D: 8E:D4:33property:Disconnected D/BT HSHFP( 1998): Received intent Intent { act=android.bluetooth.device.action.ACL_DISCONNECTED (has extras) } I/BT HSHFP( 1998): ACL disconnected I/BluetoothService( 1908): ACL disconnected, mAclLinkCount = 0 D/BluetoothA2dpService( 1908): Received intent Intent { act=android.bluetooth.device.action.ACL_DISCONNECTED (has extras) } D/WifiService( 1908): ACTION_BATTERY_CHANGED pluggedType: 2 I/BTL-IFS ( 2140): send_ctrl_msg: [BTL_IFS CTRL] send BTLIF_DTUN_SIGNAL_EVT (CTRL) 16 pbytes (hdl 10) I/DTUN_CLNT( 2155): dtun-rx signal [DTUN_SIG_DM_DEVICE_FOUND] (id 40) len 18 I/DTUN_HCID( 2155): *** sig_device_found :: addr = [00:17:91:04:11:62] class = [240428] *** I/DTUN_HCID( 2155): I/BluetoothEventLoop.cpp( 1908): event_filter: Received signal org.bluez.Adapter:DeviceFound from /org/bluez/2155/hci0 D/BluetoothService( 1908): updateDeviceServiceChannelCache(00:17:91:04:11:62) W/WindowManager( 1908): App freeze timeout expired. W/WindowManager( 1908): Force clearing freeze: AppWindowToken{44206888 token=HistoryRecord{441e6578 de.phil_dev.android.BT/.ThinBTClient}} D/BluetoothService( 1908): Cleaning up failed UUID channel lookup: 00:0B:0D:8E:D4:33 00001101-0000-1000-8000-00805f9b34fb D/BluetoothSocket( 5991): onRfcommChannelFound -1 D/BluetoothSocket( 5991): close D/BluetoothSocket( 5991): cancel D/BluetoothSocket.cpp( 5991): abortNative D/BluetoothSocket.cpp( 5991): ...asocket_abort(31) complete D/BluetoothSocket.cpp( 5991): destroyNative D/BluetoothSocket.cpp( 5991): ...asocket_destroy(31) complete Here it stops. Am I using the wrong UUID or does anybody has an better Idea. Thank you for your kindness and proper Help. Greets Philipp Toelle BTW: There is some very important Information missing on the Android- dev Page about the Bluetooth API. The android.Permissions.INTERNET have to be set in the Manifest too, because without them creating a Socket will fail. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en