Page 461 - 2
P. 461

toast.obj = " 연결중";
                       handler.sendMessage(toast);
                       try {
                          mmSocket.connect();
                          Log.d(tag, " 연결됨");

                          mmOutStream = mmSocket.getOutputStream();


                          Message toast = new Message();
                          toast.what = TOAST_MESSAGE;
                          toast.obj = " 연결됨";

                          handler.sendMessage(toast);


                          Bluetooth_Data data = new Bluetooth_Data();
                          data.setMessage("Successful");


                          Write_data(data);


                       } catch (IOException ioe) {
                          Log.d(tag, "connect  오류 : " + ioe.getMessage());
                          try {
                              mmSocket.close();
                          } catch (IOException ioe2) {
                              Log.d(tag, "mmSocketClose  오류 : " + ioe2.getMessage());
                          }
                          Message toast = new Message();
                          toast.what = TOAST_MESSAGE;
                          toast.obj = " 주변에 기기가 없습니다.";
                          handler.sendMessage(toast);
                       }
                   }
                   public void SetUUID(BluetoothDevice mdevice) {
                       BluetoothSocket tmp = null;
                       try {
                          Log.d(tag, "UUID 만들기..");
                          tmp = mdevice.createRfcommSocketToServiceRecord(uuid);
                          Log.d(tag, "UUID  성공");
                       } catch (IOException ioe) {
                          Log.d(tag, "UUID  오류 : " + ioe.getMessage());
                       }
                       mmSocket = tmp;
                   }


                   public void SettingBluetooth() {
                       final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();


                       // 페어링된 기기찾기
                       Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
                       if (pairedDevices.size() > 0) {


                                                         - 461 -
   456   457   458   459   460   461   462   463   464   465   466