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 @alvinashcraft: Getting Started with Lottie-Windows. #xaml #winui #uwp #windowsdev https://t.co/P4EWilrffA
  •   RT @WindowsUI: We are releasing new samples and documentation today showing how to use the compositor's Visual Layer APIs in win32 apps: ht…
  •   RT @JenMsft: @PXAbstraction With the latest version of W10, you can now tie snipping to PrintScreen - lets you capture things that would ot…
  •   RT @JenMsft: It was so fun to talk to the MVPs today about [REDACTED] 😁 #MVPSummit #MVPBuzz
  •   RT @JenMsft: New build for Fast! Look for 18361 - let us know how it goes once you upgrade! Details here: https://t.co/KCrMGkCsCY 😊 #Window…
  •   @JenMsft Plqn to visit 33?
  •   RT @JenMsft: Image support now rolling out for Sticky Notes if you're in Skip Ahead 😊 #WindowsInsiders Details 👉🏻 https://t.co/6IAdzNYeIs…
  •   RT @ClintRutkas: having a great time discussing Windows Development topics at the #mvpSummit. If you feel a community member is a Microsof…
  •   @NicoVermeir revenge is sweet 🤣
  •   @theothernt found a whole dutch delegation at 4am @ starbucks :)