Apps for Bluetooth, HID, and USB devices
description
Transcript of Apps for Bluetooth, HID, and USB devices
![Page 1: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/1.jpg)
![Page 2: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/2.jpg)
Apps for Bluetooth, HID, and USB devices
Ellick SungProgram Manager3-026
![Page 3: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/3.jpg)
It’s easy to build apps for a rich ecosystem of USB, HID, and Bluetooth devices
![Page 4: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/4.jpg)
Device protocol access in WindowsKey conceptsBluetooth RFCOMMResources
Agenda
![Page 5: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/5.jpg)
New Device Protocol APIs in Windows 8.1New Windows Runtime APIs:
• Bluetooth (RFCOMM)
• Bluetooth Smart
• HID• USB• Wi-Fi Direct
Innovative Devices
Ecosystem of Apps
Independent
Developers
Device Protocol APIs
![Page 6: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/6.jpg)
Demo: Sphero
![Page 7: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/7.jpg)
Key concepts
![Page 8: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/8.jpg)
User consent and confidenceAccess 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
![Page 9: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/9.jpg)
Discover and use the deviceBuilds upon existing patterns for Windows.Devices
Familiar ways to interact with each transportBluetooth – RFCOMM via Sockets (includes SPP devices)Bluetooth Smart – GATT ClientHID – Example: vendor-specific usageUSB – WinUSB based
Use standard or proprietary protocols Some inbox classes reserved
![Page 10: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/10.jpg)
Bluetooth RFCOMM
![Page 11: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/11.jpg)
Windows.Devices.Bluetooth.RfcommDevice 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
![Page 12: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/12.jpg)
Rfcomm API
RfcommDeviceService
Client - Represents a remote device service
RfcommServiceProvider
Server -Represents a local service
![Page 13: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/13.jpg)
Demo: Sphero client app sample
![Page 14: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/14.jpg)
Declaring app capabilitiesDeclare the device capabilityDevice 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
![Page 15: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/15.jpg)
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>
![Page 16: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/16.jpg)
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>
![Page 17: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/17.jpg)
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
![Page 18: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/18.jpg)
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
![Page 19: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/19.jpg)
You must dispose of your Rfcomm objects when your application is suspended.
![Page 20: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/20.jpg)
Sample code walk through
![Page 21: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/21.jpg)
TakeawaysIt’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
![Page 22: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/22.jpg)
ResourcesRelated 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 DocumentationWindows.Devices.Bluetooth.Rfcomm API referenceBluetooth RFCOMM chat sampleWindows Store app samples (search for Sphero)
![Page 23: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/23.jpg)
© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
![Page 24: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/24.jpg)
Bluetooth and Bluetooth SmartGlobal standardLow costRobustSecureProfile interoperabilityLow powerEasy to use
Wireless connectivity for devices
![Page 25: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/25.jpg)
Device protocol access made easy Windows Runtime APIs for direct access to devices:
No drivers needed, just an appLess complexity, increased reliabilitySupported on all Windows platforms
Bluetooth (RFCOMM)Bluetooth SmartHIDUSBWi-Fi Direct
![Page 26: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/26.jpg)
Hardware developersCreate an app for your device
Enable an ecosystem of appsUse a standard protocol if available…or publish your proprietary protocol
![Page 27: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/27.jpg)
Software developersCreate apps for retail devicesUse 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
![Page 28: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/28.jpg)
Windows.Devices.Bluetooth.GenericAttributeProfile
Device discovery and pairing using familiar Bluetooth user experience
Windows Runtime API to collect and administer Bluetooth Smart device dataNo driver needed
GATT Client support
![Page 29: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/29.jpg)
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.
Get your goodies
Acer Iconia W3, Surface Pro, and Surface Type Cover
![Page 30: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/30.jpg)
Evaluate this session
Scan this QR code to evaluate this session and be automatically entered in a drawing to win a prize!
![Page 31: Apps for Bluetooth, HID, and USB devices](https://reader035.fdocuments.net/reader035/viewer/2022081422/56816934550346895de08d3e/html5/thumbnails/31.jpg)
© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.