George Roussos Senior Program Manager Arvind Aiyar Senior
- Slides: 51
George Roussos Senior Program Manager Arvind Aiyar Senior Software Engineer Building apps for USB Accessories
Develop apps that can connect with hardware from the past and present
Windows 10 introduces 1) USB Accessories on Phones 2) Windows. Devices. Serial. Communication enabling you to develop apps that connect with hardware from the past and present.
USB Accessories • Windows 10 Mobile SKU adds support for USB connected accessories on new Phones and Tablets via USB Dual Role. • Developers can build accessories based upon open industry standard hardware without perunit royalties.
USB Accessories in Windows 10 Mobile SKU Windows 10 supports two kinds of USB Accessories in Mobile SKU: 1. 2. Typical accessories Vendor specific accessories
Typical accessories on Mobile SKU Examples Accessories that just work with OS • • Windows natively supports these accessory types regardless of who makes the hardware. Windows provides built-in OS experiences for many of them Audio Files Point of Service Accessories Namespace Microphone MIDI Speakers Windows. Media. Capture Windows. Devices. Midi Removable Storage Windows. Storage Magnetic Stripe Reader Windows. Devices. Pointof. Service. Barcode. Scanner Barcode Scanner Windows. Devices. Pointof. Service. Magnetic. Stripe. Reader
Vendor specific accessories • Examples: Fitness devices, Robots, Smart Toys, etc
Windows. Devices. Human. Interface. Device Custom HID Device Access Windows. Devices. Serial. Communication Custom Serial Device Access Windows. Devices. Usb Custom USB Device Access
Driver installation for vendor specific accessories Use OS inbox drivers for HID, USBSerial, or Win. USB. • Accessories should report hardware or compatible IDs that install these drivers. • Mobile SKU does NOT support installing vendor drivers from WU • Audience Challenge: Produce a USB to RS 232 cable that reports these compatible IDs • API Compatible IDs HID Follow Standard. Report Vendor_Specific Top Level Collection Serial USBClass_02&Sub. Class_02&Prot_01 USBClass_02&Sub. Class_02 Win. USB (Winusb. sys) Installation
Start developing apps for USB Accessories Start developing a universal app on desktop w/ USB port 2. Make sure the UX of your app lays out properly on phones 3. Once available get a Dual Role capable Mobile device to test your app with accessories 1.
Identifying mobile systems that support USB Accessories New Phones and Tablets that support USB dual role • Before you buy a new device • • Should be clear in device marketing if USB dual role is supported or not • On your current device USB Settings UX informs users if their mobile device supports USB connections or not
Serial Communication using Win. RT
Overview
Device Protocol APIs New Windows Runtime APIs: • Bluetooth Smart • HID • USB • Serial Devices
Unified and built-in model for device discovery, access and instantiation Serial in Windows 10 New Windows Runtime API that simplifies communicating to/from your device Works with Universal Apps – write once, deploy everywhere …
Prerequisites 1. Working knowledge of Serial Communication Introduction to Serial Communications – MSDN • 2. Good to know … Before you begin… • • Win 32 Serial Programming interface - MSDN. NET serial programming interface - MSDN 3. Knowledge of Windows Runtime concepts and paradigms • • • Async operations Data buffers and streams Fundamentals of working with devices
Architecture App. Container Architecture diagram Windows Store app Windows. Devices. Serial. Communication API Device Access Broker Native Serial layer Serial device
Demo: Arduino
Getting Started
Accessing devices from the Windows Runtime Capability 1) Author an app manifest Declare the correct capability for your device 2) Device discovery Communication Find out what devices are connected to your system 3) Find the device you’re looking for Information about a specific device 4) Communicate Access information on your device Cleanup 5) Clean up resources
App capabilities (i. e. app manifest) Capability Device discovery Communication 1. Declare the device capability • 2. Declare the device • • Device Id=“any” Device Id=“vidpid: <vid> <pid>” - if you want a specific device 3. Declare usages • Cleanup Device. Capability Name=“serialcommunication” Function Type=“name: serial. Port”
Editing the Package. appxmanifest
App. Xmanifest: example Package. appxmanifest: <Capabilities> <Device. Capability Name="serialcommunication"> <Device Id="any"> <Function Type="name: serial. Port" /> </Device. Capability > <Device. Capability Name="serialcommunication"> <Device Id="vidpid: 2341 0043"> <Function Type="name: serial. Port" /> </Device> </Device. Capability> </Capabilities>
Device discovery • Finding serial devices on your system
Capability Device discovery Communication Cleanup
Capability 1. Use the static Device. Selector methods in Serial. Device to build a serial-specific AQS: • Serial. Device. Get. Device. Selector(); • Serial. Device. Get. Device. Selector(port. Name); Device discovery • Serial. Device. Get. Device. Selector. From. Usb. Vid. Pid(vid, pid); • You can augment the selector to be more specific. 2. Use the Device Enumeration APIs to find the serial device Communication • Device. Information. Find. All. Async(aqs. Filter) OR • Device. Information. Create. Watcher(aqs. Filter) • Serial. Device From. Id. Async(Device. Information. Id) Cleanup
Device discovery using Windows. Devices. Serial. Communication; using Windows. Devices. Enumeration // Create an AQS using on of the static Device. Selector methods // USB VID/PID selector string selector = Serial. Device. Get. Device. Selector. From. Usb. Vid. Pid(vid, pid); // Friendly Name selector string selector 2 = Serial. Device. Get. Device. Selector(“COM 1”); // Pass the selector to Find. All. Async to get a collection of Device. Information // objects. Device. Information. Collection device. Information; device. Information = await Device. Information. Find. All. Async(selector);
Device instantiation await Main. Page. Current. Dispatcher. Run. Async(Core. Dispatcher. Priority. Normal, async () => { var opened. Device = await Serial. Device. From. Id. Async(device. Information. Id); if (opened. Device == null) { } else { // Begin watching for disconnect. Begin accessing the device. } }
Device instantiation Runtime Checks: 1. Capability declarations in the manifest. 2. Allowed by OS Policy. 3. Exclusivity. 4. Consent and Dynamic Access. If your app is denied access as a result of any of the above, the function returns a NULL Serial. Device object.
Serial. Device is NULL ? if (opened. Device == null) { var device. Access. Status = Device. Access. Information. Create. From. Id(device. Information. Id). Current. Status; if (device. Access. Status == Device. Access. Status. Denied. By. User) { notification. Message = "Access to the device was blocked by the user : " + device. Information. Id; } else if (device. Access. Status == Device. Access. Status. Denied. By. System) { // (Possible failure with Package. appxmanifest declaration, seen at development time only) } else { // Most likely the device is opened by another app, but cannot be sure notification. Message = "Unknown error, possibly opened by another app : " + device. Information. Id; }
Basic communication • How it all comes together …
Basic communication Declare capability Device discovery Communication Cleanup
Basic Communication // // Configure the device // serial. Device. Baud. Rate = 9600; serial. Device. Parity = Serial. Parity. None; serial. Device. Stop. Bits = Serial. Stop. Bit. Count. One; serial. Device. Handshake = Serial. Handshake. None; serial. Device. Data. Bits = 8;
Basic Communication /// Write to the device /// var data. Writer = new Data. Writer(serial. Device. Output. Stream); data. Writer. Write. String(“hello"); var bytes. Written = await data. Writer. Store. Async(); this. Notify. User("Write completed - " + bytes. Written. To. String() + " bytes written, Notify. Type. Status. Message); data. Writer. Detach. Stream();
Basic Communication /// Read from the device /// var data. Reader = new Data. Reader(serial. Device. Input. Stream); uint read. Buffer. Length = 8; UInt 32 bytes. Read = await data. Reader. Load. Async(read. Buffer. Length); if (bytes. Read > 0) { string temp = data. Reader. Read. String(bytes. Read); this. Notify. User("Read completed - " + bytes. Read. To. String() + " bytes were read", Notify. Type. Status. Message); } data. Reader. Detach. Stream();
Closing the device Declare capability 1. When done with device communication, the app must close the Serial. Device discovery Communication Cleanup 2. Be aware of language-specific nuances for object close and deletion.
Closing the device C++: delete device; device = nullptr; C#: device. Dispose(); device = null; JS: this. _device. close(); this. _device = null;
Suspension/Resume App must register for suspension 1. It must close the Serial. Device as it will be invalidated. 2. It should not send any new I/O. 3. On app resume, app must re-open the device.
Arduino: Redux • How it all comes together …
Additional features
Background tasks • App can do long running operations using background tasks. • Supports all existing triggers e. g. System Event trigger, Control Channel trigger, Device. Use trigger • Tasks aren’t throttled like other system background tasks (no CPU time quota) but will run with reduced priority to keep foreground apps responsive.
Tracing: • Windows. Devices. Serial. Communication • Device Broker Details on MSDN page
Introducing the Windows App Model Moving to Universal: Porting to Windows 10 from Windows 8. 1 XAML or Windows Phone Silverlight Developing Windows 10 Universal Apps in Visual Studio 2015 Universal App Packaging and Deployment for Windows 10 Devices Windows 10 App Lifecycle: From Activation & Suspension to Background Execution and Multitasking Optimizing Universal Apps for Continuum New Retail Peripherals and NFC/HCE Support in Windows 10 Developing universal audio and video apps for Windows Building Rich, Contextually Aware Applications Using Sensors Windows for Makers: Raspberry Pi 2, Arduino and More! Internet of Things: Overview Building Windows Apps that Discover, Connect, and Interact with Other Devices and Cloud Services Using All. Joyn
Resources: Typical accessories on Mobile SKU Examples Accessories that just work with OS • • Windows natively supports these accessory types regardless of who makes the hardware. Windows provides built-in OS experiences for many of them Audio Files Point of Service Accessories Namespace Microphone MIDI Speakers Windows. Media. Capture Windows. Devices. Midi Removable Storage Windows. Storage Magnetic Stripe Reader Windows. Devices. Pointof. Service. Barcode. Scanner Barcode Scanner Windows. Devices. Pointof. Service. Magnetic. Stripe. Reader
Windows. Devices. Human. Interface. Device Custom HID Device Access Windows. Devices. Serial. Communication Custom Serial Device Access Windows. Devices. Usb Custom USB device access
USB Accessories 1. Start developing a Universal Windows App on desktop w/ USB port 2. Make sure the UX of you’re app lays out properly on phones 3. Once available, get a Dual Role capable Mobile device to test your app with accessories 4. Make sure your vendor specific accessories report the correct hardware IDs to work with Mobile SKU : Feedback: Anything missing in our APIs? mailto: busapifb@microsoft. com
- Sertalind
- Senior manager vs general manager
- S'il faut mourir un jour demis roussos
- Demis roussos biographie
- Arvind thiagarajan mit
- Arvind seshan
- Arvind rajaraman
- Arvind lee
- Exalg
- Ans
- Arvind seshan
- Arvind vig
- Arvind krishnamurthy
- Senior development manager
- Gnld senior manager
- Portfolio manager synergy manager parental developer
- Differences between george washington and king george iii
- George washington and john adams venn diagram
- Miami beach senior high scholars program
- Gsa vehicle leasing guide
- Microsoft partner program manager
- Microsoft partner program manager
- Population health program manager
- Principal program manager microsoft
- Masonlife
- Sequential program and an event-driven program
- Perangkat lunak computer dinamakan …
- Merancang program tahunan dan program semester
- Microsoft excel merupakan program pengolah
- Microsoft excel adalah program aplikasi pengolah
- Program ms word merupakan program …. *
- Waltham forest senior management structure
- Ucf senior design
- Children's apperception test cards ppt
- Martha senior year
- Simone sheehan
- Senior youth leadership uniform
- Heap westchester county
- Senior project presentation template
- Senior project outline
- Senior night questionnaire
- Senior geography project
- Senior will
- Ehtni day
- Scarborough high school principal
- Senior reflection examples
- Senior management function
- Joe duffy senior
- Herbalife consultor senior
- Action plan for senior citizens
- Courtesies definition
- Junior senior expert