Page 1017 - 3-2
P. 1017

}
                    }
                    */


                    void write(String msg){
                        msg += "\n";
                        try {
                            mmOutStream.write(msg.getBytes());
                            mmOutStream.flush();
                        } catch (IOException e) {
                            Log.e(TAG, "Exception during send", e );
                        }
                    }


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


                private synchronized void setState(int state) {
                    Log.d(TAG, "setState() " + mState + " -> " + state);
                    mState = state;
                }


                public synchronized int getState() {
                    return mState;
                }


                public synchronized void start() {
                    Log.d(TAG, "start");


                    // Cancel any thread attempting to make a connection
                    if (mConnectThread == null) {


                    } else {
                        mConnectThread.cancel();
                        mConnectThread = null;
                    }


                    // Cancel any thread currently running a connection
                    if (mConnectedThread == null) {


                                                        - 1017 -
   1012   1013   1014   1015   1016   1017   1018   1019   1020   1021   1022