apps for bluetooth, hid, and usb devices

31

Upload: havily

Post on 25-Feb-2016

167 views

Category:

Documents


3 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Apps for Bluetooth, HID, and USB  devices
Page 2: Apps for Bluetooth, HID, and USB  devices

Apps for Bluetooth, HID, and USB devices

Ellick SungProgram Manager3-026

Page 3: Apps for Bluetooth, HID, and USB  devices

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

Device protocol access in WindowsKey conceptsBluetooth RFCOMMResources

Agenda

Page 5: Apps for Bluetooth, HID, and USB  devices

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

Demo: Sphero

Page 7: Apps for Bluetooth, HID, and USB  devices

Key concepts

Page 8: Apps for Bluetooth, HID, and USB  devices

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

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

Bluetooth RFCOMM

Page 11: Apps for Bluetooth, HID, and USB  devices

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

Rfcomm API

RfcommDeviceService

Client - Represents a remote device service

RfcommServiceProvider

Server -Represents a local service

Page 13: Apps for Bluetooth, HID, and USB  devices

Demo: Sphero client app sample

Page 14: Apps for Bluetooth, HID, and USB  devices

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

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

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

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

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

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

Page 20: Apps for Bluetooth, HID, and USB  devices

Sample code walk through

Page 21: Apps for Bluetooth, HID, and USB  devices

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

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

© 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

Bluetooth and Bluetooth SmartGlobal standardLow costRobustSecureProfile interoperabilityLow powerEasy to use

Wireless connectivity for devices

Page 25: Apps for Bluetooth, HID, and USB  devices

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

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

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

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

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

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

© 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.