Pen identity in UWP

When you are building apps for the Surface Hub you can use a real cool inking feature. The screen is already amazing with 84" and the pen support. But the pens also have an identity. This is a number and when you match this up with a credential you can do awesome things.

To get the pen identity you need few simple lines of code. I build an extension method for that:

public static class PointerPointPropertiesExtensions
    private const uint WirelessIdUsagePage = 0x0D;
    private const uint WirelessIdUsage = 0x5B;

    public static int? GetPenId(this PointerPointProperties pointerProperties)
        var hasId = pointerProperties.HasUsage(WirelessIdUsagePage, WirelessIdUsage);
        return hasId ? pointerProperties.GetUsageValue(WirelessIdUsagePage, WirelessIdUsage) : default(int?);
  •   RT @koujaku: We just released the #MixedReality Lighting Tools on Github! It's a standalone library and MRTK extension for estimating and r…
  •   RT @rajen_k: Just announced: Visual Studio 2019 will be released on April 2, 2019 at the Visual Studio 2019 Launch Event. Check it out! htt…
  •   @maarten_goet Had je er aan getwijfeld dan? Navigatie versie doet in flight nav ook ;)
  •   @shanselman and how much ram you gonna need to run that?
  •   @maarten_goet Slechte rekenmachine staat nog wel in de store: maar voor de koers berekening prima
  •   @maarten_goet Skydemon en voor Windows zelf iets gebouwd maar moet daar de kaart materiaal even updaten
  •   @maarten_goet wel schattig om naast meest moderne computer dan nog een ouderwetse flight computer en protractor te…
  •   @terrajobst Meeee
  •   @JenMsft is there a preview program for the mail app? seeing on internet new dark mode features but on my laptop in…
  •   RT @andrewclinick: Announcing Project Rome SDK for Android and iOS version 1.0! - Windows Developer Blog