| PST SDK 6.0.0.0-272350a

minimal/minimal.cs
// Copyright PS-Tech B.V. All Rights Reserved.
using System;
using System.Threading;
using PSTech.Pstsdk;
namespace PSTech.Minimal
{
public class Minimal
{
class MyTrackerListener : TrackerListener
{
public override void OnTrackerData(TrackerData data, ErrorStatus status)
{
// Do something with the tracker data in data
}
}
static void Main(string[] args)
{
// Implement error handling of PSTech.TrackerException exceptions to prevent
// improper PST Tracker shutdown on errors.
try
{
// Create an instance of the Tracker object using the default configuration path and file names.
Tracker tracker = new Tracker();
//Create tracker listener with callback functions for data and/or mode updates.
TrackerListener listener = new MyTrackerListener();
// Register the TrackerListener object to the tracker server.
tracker.AddTrackerListener(ref listener);
// Start the tracker server.
tracker.StartTracker();
// Wait for 10 seconds, allowing for the detection of tracking targets.
Thread.Sleep(10000);
}
catch (Exception e)
{
// Do something with the error.
}
finally
{
// Make sure that the connection to the PST Tracker is shut down properly.
Tracker.Shutdown();
}
}
}
}