Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

USB Host APIで遊んでみた

11 989 vues

Publié le

Publié dans : Technologie
  • DOWNLOAD FULL. BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • あざす!
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

USB Host APIで遊んでみた

  1. 1. USB Host API P-touch RL RL-700S
  2. 2. • (@zaki50)•• Android ( StickyShortcut) A3
  3. 3. USB Host
  4. 4. USB Host Android 3.1 Platform highlights• Honeycomb 3.1• OS (HID Mass Storage)• ( )
  5. 5. USB Host API• USB API• OS• USB•
  6. 6. • : USB UsbDeviceConnection• : UsbDeviceConnection
  7. 7. • Intent (IntentFilter )• (listDevices )
  8. 8. IntentFilterAndroidManifest.xml <intent-filter>     <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> </intent-filter> <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"     android:resource="@xml/device_filter" />res/device_filter.xml <?xml version="1.0" encoding="utf-8"?> <resources>     <usb-device vendor-id="1234" product-id="5678" /> </resources>
  9. 9. listDevice• USB Device•• BroadcastReceiver /
  10. 10. private static final String ACTION_USB_PERMISSION = "hogehoge.USB_PERMISSION";• IntentFilter private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (ACTION_USB_PERMISSION.equals(action)) { synchronized (this) { final UsbDevice device = (UsbDevice) intent• BroadcastReceiver .getParcelableExtra(UsbManager.EXTRA_DEVICE); if (!intent.getBooleanExtra(UsbManager .EXTRA_PERMISSION_GRANTED, false)) { Log.i(TAG, "USB Permission denied"); PrintActivity.this.setResult(Activity.RESULT_CANCELED); PrintActivity.this.finish(); return; } // requestPermission } } } }; // registerReceiver(mUsbReceiver, new IntentFilter(ACTION_USB_PERMISSION)); final PendingIntent pi = PendingIntent.getBroadcast(this, 0, new Intent( ACTION_USB_PERMISSION), 0); mManager.requestPermission(device, pi);
  11. 11. USB• vendor ID product ID• Interface• interface Endpoint• Endpoint ( / )
  12. 12. Endpoint• Control ↓• Interrupt http://ja.wikipedia.org/wiki/ Universal_Serial_Bus• Bulk• Isochronous
  13. 13. • claimInterface• Endpoint • controlTransfer/bulkTransfer • UsbRequest
  14. 14. UsbEndpoint endpoint = ...; // Endpointbyte[] buffer = ...;int timeoutMillis = 5000;final int sent = conn.bulkTransfer(endpoint, buffer, buffer.length, timeoutMillis); • • buffer offset
  15. 15. UsbDeviceConnection conn = ...;UsbEndpoint in = ...;ByteBuffer recvBuffer = ByteBuffer.allocate(in.getMaxPacketSize());UsbRequest recvReq = new UsbRequest();recvReq.initialize(conn, in); // Endpointwhile (true) { recvReq.queue(recvBuffer, recvBuffer.remaining()); // UsbRequest request = conn.requestWait(); // if (request != recvReq) { // break; } // recvBuffer}
  16. 16. • 1 UsbConnection •
  17. 17. • bulkTransfer• UsbRequest• type Control bulkTransfer controlTransfer
  18. 18. • @touchRL twitter RFID• Windows• Mac
  19. 19. @touchRL
  20. 20. • DevGuide (USB - Host) http://developer.android.com/guide/topics/usb/host.html• http://developer.android.com/resources/samples/USB/ index.html• (github) • RL-700S http://goo.gl/fFA93 • RL-700S http://goo.gl/rV7TZ

×