i have encountered problem when connecting android tablet (5.0.1) bluetooth chip module. problem tablet not connect, yet bluetooth module says connected.
my code is:
private uuid uuid = uuid.fromstring("00001101-0000-1000-8000-00805f9b34fb"); public synchronized void run() { try { mysocket = btdevice.createinsecurerfcommsockettoservicerecord(uuid); } catch (ioexception createsocketexception) { // problem creating socket log.e(excp_log, "exception", createsocketexception); } // cancel discovery on bluetooth adapter prevent slow connection btadapter.canceldiscovery(); try { log.d("bluetooth_debug", "attempting connect"); mysocket.connect(); isconnected = true; } catch (ioexception connectexception) { log.d("bluetooth_debug", "connect thread exception"); connectexception.printstacktrace(); } mhandler.obtainmessage(connected).sendtotarget(); }
and logcat print out is:
w/bluetoothsocket: readall() looping, read partial size: 11, expect size: 16 w/system.err: java.io.ioexception: connection failure, wrong signal size: 7 w/system.err: @ android.bluetooth.bluetoothsocket.waitsocketsignal(bluetoothsocket.java:503) w/system.err: @ android.bluetooth.bluetoothsocket.connect(bluetoothsocket.java:327) w/system.err: @ bluetoothpackage.connecttobluetooth.run(connecttobluetooth.java:72) w/system.err: @ java.lang.thread.run(thread.java:818)
where connecttobluetooth.java code above , line 72 mysocket.connect() command.
any on appreciated
Comments
Post a Comment