Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Read device information

Two system operations report what a device is and what it can do. Both are available on every device type.

List what the device supports

get_capabilities returns the feature catalogue. The SDK fetches it during initialize() and caches it, so reading the cache costs nothing.

const capabilities = client.getCachedCapabilities();

for (const [name, feature] of Object.entries(capabilities.features)) {
  console.log(name, feature.operations.join(", "));
}
capabilities = client.get_cached_capabilities()

for name, feature in capabilities.features.items():
    print(name, ", ".join(feature.operations))

Re-query when a device may have changed, such as after a firmware update:

const fresh = await client.getCapabilities();
fresh = await client.get_capabilities()

Each feature carries three parts:

Part
Contains

operations

The operation names the feature accepts

limits

Device-declared bounds, such as maximum stream count

metadata

Device-declared values, such as contact quality thresholds

What comes back depends on the device:

Seven features: system, registers, motors, eeg, impedance, firmware, auth.

impedance metadata carries the contact quality thresholds the SDK classifies against, so read them from here rather than hardcoding them.

Two features: system and analog_input.

system additionally declares scan_devices, which Anthriq headsets do not.

metadata is where a device parameterises SDK behaviour rather than the SDK assuming it. See Impedance measurement.

Branch on capability, not on device type

Checking the capability keeps code working when a device gains a feature.

The SDK performs the same check on every call. An undeclared operation returns a failed response listing what is available, and never reaches the device. See Device support.

Read the current state

get_state reports the connection state and device metadata.

Field
Type
Description

statusMessage

string

Human-readable state

details

Record<string, string>

Device metadata; absent when disconnected or in error

lastUpdate

string

Timestamp of the last state change

details is populated only when the device is connected and healthy, so read it defensively rather than assuming it is present.

Watch for state changes

Subscribe rather than polling. The device pushes an update whenever its state changes.

Unsubscribe with the same feature and operation used to subscribe:

A state subscription is the cheapest way to notice a device dropping out mid-session, which otherwise surfaces as a timeout on whatever operation runs next.

Enumerate xBud hardware

xBud adds scan_devices, which lists attached hardware. anthriq-instinct does not declare it.

See Acquire analog input from xBud for querying one device in detail.

Next steps

Last updated

Was this helpful?