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

try  {

                                 mmOutStream.write(buffer);

                                 //  Share  the  sent message back  to  the UI  Activity


                                 mHandler.obtainMessage(Main1.MESSAGE_WRITE,  -1, -1,

                                                                                                   buffer).sendToTarget();

                            } catch (IOException  e) {

                                       Log.e(TAG,  "Exception  during write", e);

                                       BluetoothTestService.this.start();


                            }

                       }

                       // 종료..

                       public void  cancel() {

                            try {


                                 mmSocket.close();

                            } catch (IOException  e) {

                                 Log.e(TAG,  "close() of  connect  socket  failed",  e);

                            }

                       }


                 }

                 public  synchronized void  connect(BluetoothDevice  device,  boolean  secure)  {

                       if (D)  Log.d(TAG,  "connect to:  "  +  device);

                       // Start the  thread  to connect with  the  given  device

                       mConnectThread  =  new  ConnectThread(device,  secure);


                                                                                                              //  연결담당  쓰레드  클래스  생성

                       mConnectThread.start();

                       //setState(STATE_CONNECTING);




                                                         -  564  -
   566   567   568   569   570   571   572   573   574   575   576