Monday, May 30, 2016

New Nuget Package for Custom UWP Siren Apps

We just release a new SirenOfShame.Device nuget package for controlling sirens from Universal Windows Platform (UWP) projects.  Between that and the new cross platform soscmd.jar capability we released last week, and the original device api, there's no reason not to build that siren-based bathroom timer you've always wanted for your office.

What's cool about our new UWP support is that you can now build apps for a wide range of devices including Windows PC's, tablets, (phones?), Raspberry Pi's running Windows IoT, and even XBox (!).  In fact, the first person that successfully runs a siren from an XBox gets a free mug (tweet us).

The documentation is in the GitHub project, but at the moment it looks something like the following.

Getting Started


To create your own custom siren of shame device software:
  1. In Visual Studio Create new Universal Windows Platform project
  2. In Nuget Package Manager:
    Install-Package SirenOfShame.Device
  3. Add the following to the Package.appxmanifest:
    <Capabilities>
      <DeviceCapability Name="humaninterfacedevice">
        <Device Id="vidpid:16D0 0646">
          <Function Type="usage:FF9C 0001"/>
        </Device>
      </DeviceCapability>
    </Capabilities>
  4. Instantiate a SirenOfShameDevice, subscribe to Connected, try turning on the led's like this:
    public MainPage() {
      _sirenOfShameDevice = new SirenOfShameDevice();
      _sirenOfShameDevice.Connected += SirenOfShameDeviceOnConnected;
    }
    private async void SirenOfShameDeviceOnConnected(
      object sender, EventArgs eventArgs) {
    
      var manualControlData = new ManualControlData
      {
        Led0 = (byte)255,
        Led1 = (byte)255,
        Led2 = (byte)255,
        Led3 = (byte)255,
        Led4 = (byte)255,
        Siren = false
      };
      await _sirenOfShameDevice.ManualControl(manualControlData);
    }
  5. For more details on how to use the API check out the SirenOfShame.HardwareTestGui project

Summary


We hope you enjoy. Please consider sharing anything fun that you create. If you have any questions please don't hesitate to ask on twitter, facebook, or here in the comments.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.