private void setBroadcastReceivers(Context context, Intent intent) { mUsbReceiver.OnReceive(context, intent); string action = intent.Action; if (ACTION_USB_PERMISSION.Equals(action)) { lock (this) { UsbDevice device = (UsbDevice)intent .GetParcelableExtra(UsbManager.ExtraDevice); if (intent.GetBooleanExtra( UsbManager.ExtraPermissionGranted, false)) { if (device != null) { // call method to set up device communication UsbDataBinder binder = new UsbDataBinder(mUsbManager, device); var a = mHashMap[device]; } } } } }
private void setBroadcastReceiversDetach(Context context, Intent intent) { mUsbDetachReceiver.OnReceive(context, intent); string action = intent.Action; if (UsbManager.ActionUsbDeviceAttached.Equals(action)) { showDevices(); } }
private void setBroadcastReceiversAttached(Context context, Intent intent) { mUsbAttachReceiver.OnReceive(context, intent); string action = intent.Action; if (UsbManager.ActionUsbDeviceDetached.Equals(action)) { UsbDevice device = (UsbDevice)intent.GetParcelableExtra(UsbManager.ExtraDevice); if (device != null) { UsbDataBinder binder = mHashMap[device]; if (binder != null) { binder.onDestroy(); mHashMap.Remove(device); } } } }