Page 1015 - 3-2
P. 1015

} catch (IOException e) {
                            connectionFailed();
                            Log.d(TAG, "Connect Fail");


                            try {
                                mmSocket.close();
                            } catch (IOException e2) {
                                Log.e(TAG,
                                        "unable to close() socket during connection failure",
                                        e2);
                            }
                            BluetoothService.this.start();
                            return;
                        }




                        synchronized (BluetoothService.this) {
                            mConnectThread = null;
                        }




                        connected(mmSocket, mmDevice);
                    }


                    public void cancel() {
                        try {
                            mmSocket.close();
                        } catch (IOException e) {
                            Log.e(TAG, "close() of connect socket failed", e);
                        }
                    }
                }


                private class ConnectedThread extends Thread {
                    private final BluetoothSocket mmSocket;
                    private final InputStream mmInStream;
                    private final OutputStream mmOutStream;


                    public ConnectedThread(BluetoothSocket socket) {
                        Log.d(TAG, "create ConnectedThread");
                        mmSocket = socket;
                        InputStream tmpIn = null;
                        OutputStream tmpOut = null;


                        try {


                                                        - 1015 -
   1010   1011   1012   1013   1014   1015   1016   1017   1018   1019   1020