예제 #1
0
 //
 public override void OnReceive(Context context, Intent intent)
 {
     //Toast.MakeText (context, "Received intent: '"
     //  + intent.Action + "'",
     //  ToastLength.Long).Show ();
     if (intent.Action == BluetoothAdapter.ActionDiscoveryStarted)
     {
         //
     }
     else if (intent.Action == MyFakeActionFound ||
              intent.Action == BluetoothDevice.ActionFound)
     {
         var objD = intent.GetParcelableExtra(BluetoothDevice.ExtraDevice);
         var dev  = (BluetoothDevice)objD;
         if (!_parent._handlerActive)
         {
             // ActionFound occurs if any installed app/system runs inquiry.
         }
         else
         {
             var    objC              = intent.GetParcelableExtra(BluetoothDevice.ExtraClass);
             var    cod               = (BluetoothClass)objC;
             var    foo               = intent.GetStringExtra("foo");
             string optName           = intent.GetStringExtra(BluetoothDevice.ExtraName);
             short  optRssi           = intent.GetShortExtra(BluetoothDevice.ExtraRssi, Int16.MinValue);
             AndroidBthDeviceInfo bdi = AndroidBthDeviceInfo.CreateFromInquiry(
                 _parent._fcty,
                 dev, cod, optName, optRssi);
             _parent.HandleInquiryResultInd(bdi);
         }
     }
     else if (intent.Action == BluetoothAdapter.ActionDiscoveryFinished)
     {
         int?numResponses = null;
         _parent._handlerActive = false;
         _parent.HandleInquiryComplete(numResponses);
     }
 }