Page 566 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 566

if (mSecureAcceptThread  ==  null) {

                            mSecureAcceptThread = new AcceptThread(true);

                            mSecureAcceptThread.start();


                       }

                 }

                 private  class AcceptThread  extends Thread  {

                       // The local server  socket

                       private  final  BluetoothServerSocket  mmServerSocket;


                       private  String mSocketType;

                       public AcceptThread(boolean  secure)  {

                            BluetoothServerSocket  tmp  =  null;

                            mSocketType = secure  ?  "Secure":"Insecure";

                            //  Create a new listening server  socket


                            try {

                                 tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME_SECURE,

                                                                                                           MY_UUID_SECURE);

                            } catch (IOException  e) {

                                 Log.e(TAG,  "Socket  Type:  "  +  mSocketType  +  "listen()  failed",  e);


                            }

                            mmServerSocket  =  tmp;

                       }

                       public void  run()  {

                            BluetoothSocket  socket = null;


                            //  Listen to  the  server socket  if  we're not connected

                            while (mState  !=  STATE_CONNECTED) {

                                 try  {




                                                         -  559  -
   561   562   563   564   565   566   567   568   569   570   571