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

intent.putExtra(EXTRA_DEVICE_ADDRESS,  address);

                            //  Set  result and finish  this Activity

                            setResult(Activity.RESULT_OK,  intent);


                            finish();

                       }

                 };

                    //  The  BroadcastReceiver  that listens for discovered  devices  and

            //  changes  the  title  when  discovery  is  finished


                 private  final BroadcastReceiver mReceiver  =  new  BroadcastReceiver()  {

                       @Override

                       public void  onReceive(Context  context, Intent  intent)  {

                            String  action  =  intent.getAction();

                            //  When discovery finds a  device


                            if  (BluetoothDevice.ACTION_FOUND.equals(action))

                                         {     //action  이  BluetoothDevice.ACTION_FOUND  일때..

                                 BluetoothDevice  device =

                         intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);

                                                                                                              //  발견된  장치의  정보를  얻어와서


                                 //  If  it's  already  paired,  skip  it,  because it's  been  listed  already

                                 if  (device.getBondState()  !=  BluetoothDevice.BOND_BONDED)  {

                                                                                                                      //  페이링되지  않은  장비일경우

                                       mNewDevicesArrayAdapter.add(device.getName()  +  "\n"  +

                                                                     device.getAddress());    //  목록에  추가한다.


                                 }

                                 //  When discovery  is  finished,  change  the Activity  title

                            } else  if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action))  {




                                                         -  555  -
   557   558   559   560   561   562   563   564   565   566   567