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.

Monday, May 23, 2016

Announcing soscmd-1.0.jar

Until today integrating a siren of shame device into non-continuous integration workflows has involved either writing a custom app or paying for a Team CI Pro subscription to get a custom HTTP endpoint for your siren.  Even still the Linux story has been weak and the Mac story has been non-existent.

Today we are happy to release a new tool to address non-CI, cross-platform, custom workflow requirements of siren owners.  That tool is soscmd-1.0.jar.



As with everything, soscmd is open source.  All of the hardest work was performed with a generous contribution from Filip Hanik.  We are very grateful to him for his help.

Finally, this tool is also our first step in working toward a truly cross platform CI monitoring solution.  More details to come.

How-to


To get started
  1. Download soscmd-1.0.jar.  
  2. Ensure you have Java 8 JRE or later installed
  3. Enter java -jar soscmd-1.0.jar
With any luck you'll get something like this:

usage: soscmd -[i|ra|rl|m|l|a|sa|sl]

        -i  Retrieve info about device
        -ra List audio patterns
        -rl List led patterns
        -m  Manually set LED's
        -l  Play an LED pattern
        -a  Play an audio pattern
        -sa Stop audio
        -sl Stop LED's


At this point you should be able to connect a siren and do

java -jar soscmd-1.0.jar -i

and get something like this:

Firmware Version: 2

Hardware Type: Standard
Hardware Version: 1
Audio Mode: 0
Audio Play Seconds Remaining: 0
Led Mode: 0
Led Play Seconds Remaining: 0
External Memory Size: 0


Now if you want to manually light up some of the light bars you can do

java -jar soscmd-1.0.jar -m 128 0 255 0 0

which will set the 1st led bar to 50%, the 3rd led bar to 100% and the remaining bars to off.

To view the led or light patterns that your device has (which is based on your device's firmware) enter either the -ra or -rl command and you'll get something like this:

java -jar soscmd-1.0.jar -ra
Audio Patterns:
1 - Sad Trombone
2 - Ding!
3 - Plunk

If you want to play one of the audio commands above note the ID# and specify it along with a duration in seconds like this:

java -jar soscmd-1.0.jar -a 1 5

That plays the Sad Trombone for 5 seconds.  You can accomplish the same thing with a -l command to play led patterns or you can turn audio or led patterns off with -sa or -sl.

Summary


That's it!  Hope you enjoy, and if you do something fun with it please let us know.

Wednesday, May 11, 2016

New API: Snapshot Stats

If you're a Team CI Pro user enjoying the weekly e-mails and stats, and thinking what fun you could have with that raw data (we won't judge), then we've got some fantastic news: we've opened up a new API just for you!

Weekly recap e-mail

This API is basically a list of weekly snapshots of your teams stats.  We originally took these snapshots to get the delta's that are in the e-mails.  But now they're available for you to use and abuse.

API Key


To get started you'll need an API key.  To get it click the new "Get Your API Key" button in the Team CI section of the site.



Then type your password, click the button and copy the resulting API Key.



Hit That API


To get the data POST to http://sirenofshame.com/ApiV1/Snapshots.  To pass your credentials you can use: Content-Type: application/json with

{'UserName': '[YourUsername]','Password': '[YourApiKey]'}

or if you prefer you can use Content-Type: application/x-www-form-urlencoded with

Username=[YourUsername]&Password=[YourApiKey]

In other words:

curl --url http://sirenofshame.com/ApiV1/Snapshots -H "Content-Type:application/x-www-form-urlencoded" -d "UserName=[Username]&Password=[ApiKey]"

The result is hopefully something like:

{
    "Success": true,
    "ErrorMessage": null,
    "Result": [
        {
            "StatSnapshotId": 174,
            "SnapshotDate": "/Date(1428091201543)/",
            "Users": [
                {
                    "DisplayName": "Lee Richardson",
                    "RawName": "leerichardson",
                    "Fseb": 4,
                    "TotalBuilds": 399,
                    "Csb": 0,
                    "FailPercent": 105,
                    "Achievements": 12,
                    "Reputation": 189,
                    "UserId": 782,
                    "UserStatSnapshotId": 2958
                },
                { /* all of your other users should be listed here */ }        
           ]
        },
        /* up to 2 years worth of snapshots should be here */
    ]
}

Summary


Hope you enjoy.  If you do something fun with the data please consider sharing by posting here or shooting us a note on twitter or Facebook.