AGENT.Contrib - AGENT, Community and you!

Sign in to queue


Today's Hardware Friday post is one that I promised to do a couple weeks ago, The AGENT Emulator & Bluetooth and again takes us back to the AGENT SmartWatch, You don't have to be a Secret Agent to develop for the AGENT SmartWatch (You just have to read this...)

But today, it's code. And you. And community. And code...


A set of useful class libraries which should help folks create amazing Faces and Apps for AGENT SmartWatch.

I'm taking pull requests, and ideas for contributions.

If you browse the source real quick I have added a few Samples as to how to start using some of the features:

  • SimpleWatchFace - just a super simple example as to how to print the time on the screen.
  • SimpleWatchFaceWithButtons - simple time on the screen, and responds to the MiddleRight button to toggle showing the date on the screen.

Other highlights:


Drawing class:

  • A bunch of useful methods for drawing watch hands (for analog watch faces)
  • A method to draw a batter, with correct filler depending on the % of battery life
  • Drawing text or images at the center of the screen
  • Measuring Text width, based on fonts

Parse class:

  • All sorts of string to number parsing methods, and converting byte[] to string

GeoLocation class

  • Initial set of interfaces for defining location and position data. If we all can agree on an interface, then it will just make it easier for the entire community to create apps and faces...

Hardware class

  • ButtonHelper class is a threadsafe way for dealing with buttons. Can just wire up an event for the buttons you care about. No need to deal with InterruptPorts, and the class will automatically tell you which button and direction was clicked.

Reflection utilities

  • More advanced class, used to load up other types dynamically, etc..

Sample Usage

  • Download and build the Agent.Contrib project.
  • Create a new "Micro .NET Framework" "Command line" application
  • Import your favourite font as a resource, here we will use NinaB
  • Add a reference to Microsoft.SPOT.Graphics
  • Add a reference to AGENT.Contrib project
  • Add a new file to the project, called "BasicFace.cs"
  • Update BasicFace.cs to the following code:


Using Multiple Buttons

By default, watch faces only support the middle button the default for the button helper is to only enable the single button. If you want to enable all of the buttons on the right side, just use this prior to any calls to the button helper:

For example, place it at the top of your Main() in Program.cs


So what are we talking about here? About a ton of great helpers, utilities and samples too!


Here's some of the samples...



In short, if you're doing AGENT Dev, you've got to check out this project... um.. now...

The Discussion

Add Your 2 Cents