Skip to main content

IDeviceClient

interface thread-safe
namespace AR51.Net;

public interface IDeviceClient

The apps and devices connected to the AR 51 system: headsets, Unity and Unreal apps, phones and Mocap Studio. Use it through IAR51Client.Devices. Read-only.

Devices follows the system live; all members are safe to use from any thread.

How-to

This page is reference (facts only). For a walkthrough with a complete sample, see the Devices guide.

Properties​

PropertyTypeAccessDescription
DevicesIReadOnlyList<DeviceInfo>getThe connected devices. Empty while not connected.

Events​

Standard .NET events (EventHandler<T>): subscribe with +=, unsubscribe with -=. They are raised on a background thread.

EventArgsRaised when
DevicesChangedDevicesChangedEventArgsRaised when a device connects or disconnects, or a battery level changes. Raised on a background thread. Battery levels are refreshed about every 10 seconds.
Example
ar51.Devices.DevicesChanged += (_, e) =>
{
foreach (DeviceInfo device in e.Added) Console.WriteLine($"+ {device.Name} ({device.Platform})");
foreach (DeviceInfo device in e.Removed) Console.WriteLine($"- {device.Name}");
};

Small types used by this interface, documented here.

DeviceInfo​

record · sealed
public sealed record DeviceInfo(string Id, string Name, string Host, DeviceType Type, DevicePlatform Platform, int? BatteryPercent);

A device connected to the AR 51 system.

PropertyTypeDescription
IdstringThe device's unique id. A skeleton's Skeleton.DeviceId names the headset its person wears.
NamestringThe device's name, for example "Quest 3 - Player 2".
HoststringThe device's IP address.
TypeDeviceTypeThe kind of device.
PlatformDevicePlatformThe exact platform.
BatteryPercentint?Battery level from 0 to 100, or null when the device does not report it.

DeviceType​

enum
public enum DeviceType

The kind of a connected device.

ValueMeaning
Computer = 0A computer running an AR 51 app (Unity or Unreal).
Headset = 1A VR, AR or mixed reality headset.
Phone = 2A phone or tablet.
MocapStudio = 3AR 51 Mocap Studio.

DevicePlatform​

enum
public enum DevicePlatform

The platform of a connected device.

ValueMeaning
Pc = 0A Windows, Linux or macOS computer.
HoloLens = 1Microsoft HoloLens.
HoloLens2 = 2Microsoft HoloLens 2.
Android = 3An Android phone or tablet.
MagicLeap = 4Magic Leap.
OculusRift = 5Oculus Rift.
MetaQuest = 6Meta Quest, running stand-alone.
HtcVive = 7HTC Vive.
OpenXrTethered = 8An OpenXR headset tethered to a computer.
OpenXrMobile = 9A stand-alone OpenXR headset.
PicoNeo3Pro = 10Pico Neo 3 Pro.
MetaQuestLink = 11Meta Quest tethered to a computer (Quest Link).
HtcFocus3 = 12HTC Vive Focus 3.
MocapStudioWindows = 13Mocap Studio on Windows.
MocapStudioLinux = 14Mocap Studio on Linux.
MocapStudioMac = 15Mocap Studio on macOS.

DevicesChangedEventArgs​

class · sealed
public sealed class DevicesChangedEventArgs : EventArgs

Data for IDeviceClient.DevicesChanged.

PropertyTypeAccessDescription
AddedIReadOnlyList<DeviceInfo>getDevices that connected.
RemovedIReadOnlyList<DeviceInfo>getDevices that disconnected.
DevicesIReadOnlyList<DeviceInfo>getEvery connected device after the change, with current battery levels.
Constructor
public DevicesChangedEventArgs(IReadOnlyList<DeviceInfo> added, IReadOnlyList<DeviceInfo> removed, IReadOnlyList<DeviceInfo> devices);

Creates the event data.

See also​

Was this page helpful?