Predecessors, I am new Bluetooth serial port this development, doing time data transmission. Been reported
java.io.IOException: [JSR82] write: write () failed. Mistakes, get half do not know what the problem.
I have the appropriate permissions added.
Seeking guidance on January grateful.
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Amount, ask for replies ah
Reply:
Do not you see how the code ah, the first pairing, the connection is already paired device to select
Reply:
Estimates are problems connected, sending data is generally not a problem, unless the amount of data is too large
Reply:
socket = device.createRfcommSocketToServiceRecord (UUID
. FromString ("00001101-0000-1000-8000-00805F9B34FB"));
if (socket.isConnected ())
socket.close ();
/ / Cancel the search
if (mBtAdapter! = null) {
mBtAdapter.cancelDiscovery ();
}
socket.connect ();
boolean ss = socket.isConnected ();
progressDialog.dismiss ();
OutputStream os = socket.getOutputStream ();
String str = "fdfdfa050d0a";
os.write (hexStringToBytes (str));
When I tested this with a simple code, which also failed to send.
LOG follows:
04-17 10:40:17.128: E / connect (23390): java.io.IOException: [JSR82] write: write () failed
.04-17 10:40:17.128: E / connect (23390): at android.bluetooth.BluetoothSocket.write (BluetoothSocket.java: 702)
04-17 10:40:17.128: E / connect (23390): at android.bluetooth.BluetoothOutputStream.write (BluetoothOutputStream.java: 85)
04-17 10:40:17.128: E / connect (23390): at java.io.OutputStream.write (OutputStream.java: 82)
04-17 10:40:17.128: E / connect (23390): at com.mnhealth.TestSugar $ clientThread.run (TestSugar.java: 201)
System is android 4.2.2
Please help gets it. .
Reply:
No comments:
Post a Comment