+ if (D) Log.e(TAG, "close_socket failed");
+ }
+ }
+ }
+
+ public void close() {
+ super.close();
+ input = null;
+ output = null;
+ }
+
+ private final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
+
+ private void create_socket(BluetoothDevice device) {
+
+ BluetoothSocket tmp_socket = null;
+
+ try {
+ tmp_socket = device.createInsecureRfcommSocketToServiceRecord(SPP_UUID);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ if (socket != null) {
+ if (D) Log.d(TAG, String.format("Socket already allocated %s", socket.toString()));
+ close_device();
+ }
+ synchronized (this) {
+ socket = tmp_socket;
+ }
+ }
+
+ private class ConnectThread extends Thread {
+
+ public void run() {
+ if (D) Log.d(TAG, "ConnectThread: BEGIN");
+ setName("ConnectThread");
+
+ if (pause) {