1 / 31

Apps for Bluetooth, HID, and USB devices

Apps for Bluetooth, HID, and USB devices. Ellick Sung Program Manager 3 -026. It’s easy to build apps for a rich ecosystem of USB , HID, and Bluetooth devices. Agenda. Device protocol access in Windows Key concepts Bluetooth RFCOMM Resources. New Device Protocol APIs in Windows 8.1.

havily
Download Presentation

Apps for Bluetooth, HID, and USB devices

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Apps for Bluetooth, HID, and USB devices Ellick Sung Program Manager 3-026

  2. It’s easy to build apps for a rich ecosystem of USB, HID, and Bluetooth devices

  3. Agenda • Device protocol access in Windows • Key concepts • Bluetooth RFCOMM • Resources

  4. New Device Protocol APIs in Windows 8.1 New Windows Runtime APIs: Bluetooth (RFCOMM) Bluetooth Smart HID USB Wi-Fi Direct Device Protocol APIs Innovative Devices Ecosystem of Apps Independent Developers

  5. Demo: Sphero

  6. Key concepts

  7. User consent and confidence • Access restricted to capabilities declared in the app manifest • High-level capability exposed to the user, who must consent to allow the app to access the device • User may revoke access at any time • Ability to restrict down to the specific capability and device • Ensuring app permissions are controlled by the user

  8. Discover and use the device • Builds upon existing patterns for Windows.Devices • Familiar ways to interact with each transport • Bluetooth – RFCOMM via Sockets (includes SPP devices) • Bluetooth Smart – GATT Client • HID – Example: vendor-specific usage • USB – WinUSB based • Use standard or proprietary protocols • Some inbox classes reserved

  9. Bluetooth RFCOMM

  10. Windows.Devices.Bluetooth.Rfcomm • Device discovery and pairing using familiar Bluetooth user experience • Windows Runtime API to connect, host, and communicate with Bluetooth RFCOMM device services • Devices using Serial Port Profile (SPP) are supported • Service Discovery Protocol (SDP) client and server

  11. Rfcomm API RfcommDeviceService Client - Represents a remote device service RfcommServiceProvider Server -Represents a local service

  12. Demo: Sphero client app sample

  13. Declaring app capabilities • Declare the device capability • Device capability name: “bluetooth.rfcomm” • Declare the RFCOMM Service • “name:<ServiceName>” • “serviceId:<ServiceUuid>” • Optional: Restrict your app to a specific device • “any” • “vidpid: <vendor Id> <product Id> <ID source: bluetooth | usb>” • Declare the RFCOMM capabilities in the app manifest

  14. Declaring app capabilities (basic) • <!–- We'll use the Serial Port Profile service on any device. --> • <m2:DeviceCapability Name="bluetooth.rfcomm"> • <m2:Device Id="any"> • <m2:Function Type="name:serialPort" /> • </m2:Device> • </m2:DeviceCapability>

  15. Declaring app capabilities (advanced) • <!–- We'll use different services on two specific devices. --> • <m2:DeviceCapability Name="bluetooth.rfcomm"> • <m2:Device Id="any"> • <m2:Function • Type="serviceId:AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE" /> • </m2:Device> • <m2:Device Id="vidpid:2000 B000 bluetooth"> • <m2:Function Type="name:serialPort" /> • </m2:Device> • </m2:DeviceCapability>

  16. Client: Service discovery and instantiation • Use RfcommDeviceService’s helpers to retrieve an RFCOMM-specific selector. • RfcommDeviceService.GetDeviceSelector • Use an enumerated DeviceInformation object to instantiate an RfcommDeviceService. • RfcommDeviceService.FromIdAsync • Discover RfcommDeviceServices with the Windows.Devices. • Enumeration API

  17. Client: Communicating with the Device • Use StreamSocket.ConnectAsync to connect to the remote device. • Use the ConnectionHostName and ConnectionServiceName properties on the RfcommDeviceService to connect. • I/O over the connected StreamSocket is available via its InputStream and OutputStream properties. • You can use the DataReader and DataWriter classes to read primitive types (such as UInt32s or strings). • Use a StreamSocket to communicate with the remote device

  18. You must dispose of your Rfcomm objects when your application is suspended.

  19. Sample code walk through

  20. Takeaways • It’s easy to build Windows Store apps for USB, HID, Bluetooth, and Bluetooth Smart devices • Write apps for anything from your own device projects to retail peripherals • Make devices accessible to the entire Windows Store app ecosystem

  21. Resources • Related Sessions • [2-023] Building apps that connect with devices • [3-924a] Apps for USB devices • [3-924b] Apps for HID devices • [3-9028] Apps for Bluetooth Smart devices • Samples and Documentation • Windows.Devices.Bluetooth.Rfcomm API reference • Bluetooth RFCOMM chat sample • Windows Store app samples (search for Sphero)

  22. Bluetooth and Bluetooth Smart • Global standard • Low cost • Robust • Secure • Profile interoperability • Low power • Easy to use • Wireless connectivity for devices

  23. Device protocol access made easy • Windows Runtime APIs for direct access to devices: • No drivers needed, just an app • Less complexity, increased reliability • Supported on all Windows platforms • Bluetooth (RFCOMM) • Bluetooth Smart • HID • USB • Wi-Fi Direct

  24. Hardware developers • Create an app for your device • Enable an ecosystem of apps • Use a standard protocol if available • …or publish your proprietary protocol

  25. Software developers • Create apps for retail devices • Use the standard protocol if implemented • …or download the proprietary protocol if available • Market your apps easily via the Windows Store • Write apps for your own device projects

  26. Windows.Devices.Bluetooth.GenericAttributeProfile • Device discovery and pairing using familiar Bluetooth user experience • Windows Runtime API to collect and administer Bluetooth Smart device data • No driver needed • GATT Client support

  27. Acer Iconia W3, Surface Pro, and Surface Type Cover Get your goodies Device distribution starts after sessions conclude today (approximately 6:00pm) in the Big Room, Hall D. If you choose not to pick up your devices tonight, distribution will continue for the duration of the conference at Registration in the North Lobby.

  28. Required Slide *delete this box when your slide is finalized Your MS Tag will be inserted here during the final scrub. Evaluate this session • Scan this QR codeto evaluate this session and be automatically entered in a drawing to win a prize!

More Related