Monday, August 23, 2010

Faster RFID Application Development with the Octane SDK

The Octane SDK is a new software API from Impinj that significantly reduces the amount of time it takes to write RFID applications. It's an extension of the LLRP Toolkit (LTK) that simplifies development by handling many of the details for you. The Octane SDK can be used to develop PC and on-reader (embedded) applications. Here are some of the details:

Supported Languages

C# for PC application development on Microsoft Windows
C++ for PC or embedded development on Linux

Requirements

* A Speedway Revolution reader with firmware version 4.4.1 or higher. You can download the latest firmware from the Impinj Support Portal. The installation procedure is covered here.
* Visual Studio 2008 or newer (for Windows development).
* Windows XP or newer (for Windows development).
* 400 MHz Pentium processor (Minimum); 1GHz Pentium processor (Recommended)
* 96 MB RAM (Minimum); 256 MB RAM (Recommended)
* 50 MB hard drive space.

Developers can download the Octane SDK libraries though the Impinj Support Portal.

If you've read my Hello World LLRP post, you realize how much code is required just to read tags. The equivalent C# code for the Octane SDK is posted below. Before you give it a try, you need to take care of a few things first:

1. Download the Octane SDK from the Impinj Support Portal.
2. Create a new Visual Studio console project.
3. Create a new sub-directory under your project called 'lib'.
4. Extract the SDK files (.DLL) to the lib directory.
5. Add references to these libraries by selecting Project->Add Reference from the menu.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Impinj.OctaneSdk;

namespace HelloOctaneSdk
{
class Program
{
// Create an instance of the reader object.
public static SpeedwayReader Reader = new SpeedwayReader();

static void Main(string[] args)
{
// Connect to the reader.
// Replace "SpeedwayR-10-25-32" with your reader's hostname.
Reader.Connect("SpeedwayR-10-25-32");

// Assign an event handler for tag reports. This specifies
// which function will be called when tag reports arrive.
Reader.TagsReported +=
new EventHandler<TagsReportedEventArgs>(TagsReportedHandler);
// Assign an event hadler for logging events.
Reader.Logging +=
new EventHandler<LoggingEventArgs>(LoggingHandler);

// Clear all reader settings.
Reader.ClearSettings();

// Get the factory settings for the reader. We will
// use these are a starting point and then modify
// the settings we're interested in.
Settings settings = Reader.QueryFactorySettings();
// Send a report for every tag seen.
settings.Report.Mode = ReportMode.Individual;
// Include the antenna number in the tag report.
settings.Report.IncludeAntennaPortNumber = true;

// Apply the new settings.
Reader.ApplySettings(settings);
// Start reading tags.
Reader.Start();

// Wait until the user presses return.
Console.WriteLine("Press enter when done.");
Console.ReadLine();

// Clean up by clearing the settings and
// disconnecting from the reader.
Reader.ClearSettings();
Reader.Disconnect();
}

// The tag report event handler
public static void TagsReportedHandler(object sender,
TagsReportedEventArgs args)
{
// Loop through each tag in the report
// and print the EPC and antenna number.
foreach (Tag tag in args.TagReport.Tags)
{
Console.WriteLine("Reader saw {0} on ant#{1}",
tag.Epc, tag.AntennaPortNumber);
}
}

// The logging event handler.
public static void LoggingHandler(object sender,
LoggingEventArgs args)
{
// Write the log message to the console.
LogEntry entry = args.Entry;
Console.WriteLine("Log level =  {0} {1}",
entry.Level, entry.Message);
}
}
}