Skip to content

Quickstart

This program connects to Odyssey Desktop and prints the aimpoint of every device it tracks. Start Odyssey Desktop first, with a device connected and the screen calibrated.

using System.Threading.Channels;
using Ohc = OdysseyArm.HubClient;
using var client = new Ohc.Client();
await client.Connect();
var events = Channel.CreateUnbounded<(Ohc.uniffi.Event?, Ohc.uniffi.ClientException?)>();
_ = client.SubscribeEvents(events.Writer);
await foreach (var (ev, error) in events.Reader.ReadAllAsync())
{
if (error != null)
{
Console.WriteLine($"Stream ended: {error.Message}");
break;
}
if (ev is Ohc.uniffi.Event.DeviceEvent deviceEvent &&
deviceEvent.V1.Kind is Ohc.uniffi.DeviceEventKind.TrackingEvent tracking)
{
var aim = tracking.V1.Aimpoint;
Console.WriteLine($"{deviceEvent.V1.Device.Uuid:X}: aimpoint ({aim.X:F3}, {aim.Y:F3})");
}
}

Aim a device around the screen and watch the numbers change: (0, 0) is the top-left corner of the screen and (1, 1) the bottom-right.

These programs follow the samples in the repository, which show more of the API: Python, C#, C, C++ and Rust.