Table of Contents

Configuration Reference

Bluetooth behavior is configured declaratively, not in code. Configuration is authored once — normally through the configuration UI — and ships with your application package as BluetoothConfig.json.

Table of Contents

Where Configuration Lives

BluetoothConfiguration

BluetoothAdapterConfiguration

Profile Service Types

Class of Device

Allowed Device Classes

Multiple Adapters

Reading Configuration at Runtime

Where Configuration Lives

Select the Bluetooth extension on the Extensions tab of the OpenPV Developer Toolkit and click Configure Extension…. The Bluetooth configuration UI opens inside the Toolkit. It edits adapters, the profile services each adapter offers, and Class of Device values — including the individual service-class bits, which are tedious to get right by hand.

The Connection Setup tab of the Bluetooth configuration UI, showing adapter fields and the profile service checkboxes grouped into phone, headset, and data profiles

Adapters are listed on the left — add and remove them from the Actions panel — and each has its own profile selection. The read-only fields (Adapter Index, Device Path, Bluetooth Stack) are derived from the target platform.

The configuration UI is the intended way to configure this. It writes BluetoothConfig.json into the target's platform folder (Platform_OpenViewPro, Platform_OpenViewSelect) and keeps derived values consistent — particularly the packed Class of Device integer, which you would otherwise have to compute by hand.

Editing the JSON directly is supported and is sometimes quicker for bulk changes, so the shape is documented below. Prefer the configuration UI for anything involving Class of Device.

Note

Bluetooth Classic is OpenView Pro only, so an adapter with supportedProfileServiceTypes is only meaningful on a Pro target. A Select target uses BLE, which is configured through the BLE service rather than through adapter entries. See Supported & Not Supported.

BluetoothConfiguration

The root object:

Property Type Meaning
adapterConfigurations List<BluetoothAdapterConfiguration> One entry per adapter. Order does not matter; adapterIndex identifies them.
stack SupportedBluetoothStack StackBluez for a display, StackDesktop for the Windows stubs

BluetoothAdapterConfiguration

Property Type Meaning
deviceInterfacePath string BlueZ D-Bus object path for the adapter — /org/bluez/hci0 for the first. Leave empty for the desktop stack.
adapterIndex int The identifier your application passes on every request and reads off every notification. Start at 0.
localName string The name remote devices see when they discover the display
deviceMacAddress string The adapter's own address. Normally left empty and discovered at runtime.
reportedClassOfDevice BluetoothClassOfDevice What the display advertises itself as
allowedDeviceClasses List<BluetoothClassOfDevice> Filter applied to discovery results
supportedProfileServiceTypes List<BluetoothProfileServiceType> Which profile services this adapter runs

supportedProfileServiceTypes is the highest-consequence field. Profile services are instantiated per adapter from this list when the adapter is enabled — so a profile absent here does not exist at runtime, no matter what client your application constructs. The Classic demo also builds its panels from this list, which is why an unconfigured profile produces no tab.

A minimal adapter, with the three validated profiles:

{
  "adapterConfigurations": [
    {
      "deviceInterfacePath": "/org/bluez/hci0",
      "adapterIndex": 0,
      "localName": "OpenViewPro",
      "reportedClassOfDevice": {
        "value": 2098208,
        "audioService": true,
        "majorDeviceClass": "DeviceClassAudioVideo",
        "minorDeviceClass": 8
      },
      "supportedProfileServiceTypes": [
        "AudioSinkProfileService",
        "AudioSourceProfileService",
        "MessageAccessProfileService"
      ]
    }
  ],
  "stack": "StackBluez"
}

Profile Service Types

BluetoothProfileServiceType has six members. Only the first two and MessageAccessProfileService are hardware-validated — see Supported & Not Supported.

Value Profile Status
AudioSinkProfileService A2DP Sink + AVRCP Controller — the phone side Validated
AudioSourceProfileService A2DP Source + AVRCP Target — the headset side Validated
MessageAccessProfileService MAP — SMS/MMS Validated
PhonebookProfileService PBAP — contacts Not hardware-validated
HandsFreeProfileService HFP — calls Not hardware-validated
DataProfileService SPP — serial data Not hardware-validated

Configure only what you use. Each entry costs a live profile service per enabled adapter.

The two audio entries also need the Audio extension (Ahsoka.Extensions.AudioManager) in the application — configuring them is not enough on its own. See Getting Started.

Class of Device

Class of Device (CoD) is a 24-bit value every Classic device advertises, describing what kind of thing it is. It carries three things: a set of major service-class bits, a major device class, and a minor device class interpreted relative to the major.

The Class of Device tab, showing the display's own reported Class of Device above a grid of allowed device classes

The top section is what the display reports about itself; the grid below is the discovery filter covered in Allowed Device Classes. Edit… on either opens the bit-level editor:

The Edit Class of Device dialog, showing the service class bit checkboxes alongside major and minor device class pickers

This is where value comes from: the service-class bits and the major and minor class are set individually, and the packed integer is derived from them.

The dialog above is editing the highlighted row of the allowed-device-class grid — a wearable headset the display should accept during discovery, not the display's own identity. It has Rendering and Audio set, which is the bit pattern a headset advertises and a phone does not. Note that the minor class list offers only values valid for the selected major class, so choosing DeviceClassAudioVideo narrows it to the AudioVideoMinorDeviceClass values.

Property Meaning
value The packed 24-bit integer. Derived from the fields below; the configuration UI keeps them consistent.
majorDeviceClass BluetoothMajorDeviceClass — e.g. DeviceClassPhone, DeviceClassAudioVideo
minorDeviceClass int, interpreted against the major class. Use PhoneMinorDeviceClass or AudioVideoMinorDeviceClass to read it.
audioService, telephonyService, renderingService, capturingService, objectTransferService, networkingService, positioningService, informationService, limitedDiscoverableModeService The major service-class bits
serviceClass, serviceClassDescription Derived, read-only conveniences

A display configured for car audio typically reports DeviceClassAudioVideo with the Car Audio minor class and audioService set — which is what CreateDefaultPrimaryAdapter produces.

Class of Device for identity, SDP for capability

This distinction matters when you classify a device, and getting it backwards is a common bug.

  • CoD answers "what is this?" — is it a phone or a headset? Use it to decide which list a device belongs in, or which icon to show.
  • SDP profile flags (BluetoothDevicePairedInfo.SupportedProfiles) answer "will this work?" — does it actually speak A2DP Sink? Use them to decide whether an action is offered.

Use both. CoD alone will offer A2DP streaming to an audio-class device that is in fact HFP-only, and the connect will fail. Profile flags alone will put any dual-role device in two lists at once, because "can sink audio" is not the same question as "is a headset".

There is a second reason not to lean on profile flags for classification: SupportedProfiles is only authoritative after pairing. Before pairing it may be incomplete. For a discovery list, CoD is the only dependable classifier you have.

A practical pattern — combine the two, and treat an unreported or uncategorised class as a pass so an oddly-configured device degrades to profile-only behavior instead of vanishing:

// A headset: audio-class device that can actually sink A2DP
bool isHeadset =
    device.SupportedProfiles.HasFlag(BluetoothProfilesFlags.A2dpSink) &&
    IsDeviceClassOrUnknown(device, BluetoothMajorDeviceClass.DeviceClassAudioVideo);

// A phone: phone-class device that can actually source A2DP
bool isPhone =
    device.SupportedProfiles.HasFlag(BluetoothProfilesFlags.A2dpSource) &&
    IsDeviceClassOrUnknown(device, BluetoothMajorDeviceClass.DeviceClassPhone);

The Classic demo implements IsDeviceClassOrUnknown on ConnectablePanel and uses exactly these two filters in its Headset and Phone panels.

Tip

Do not use the audio service-class bit to tell a headset from a phone. Phones set it too. If you want a secondary signal beyond majorDeviceClass, the rendering bit is the clean one — headsets set it and phones do not.

Allowed Device Classes

allowedDeviceClasses filters discovery. A discovered device whose Class of Device does not match an entry in the list is not reported to your application at all.

This exists so an in-vehicle display does not present a list of keyboards, mice, and laptops when the user is trying to find their phone. The default list, produced by CreateDefaultPrimaryAdapter, covers phones plus the common headset classes.

Two cautions:

  • An empty list means no filtering — every discovered device is reported.
  • The filter is applied to discovery only. It does not affect already-paired devices, and it is not a security control. A device that is filtered out of discovery can still connect if it is paired.

Multiple Adapters

Each adapter gets its own entry with its own adapterIndex, deviceInterfacePath, and — importantly — its own supportedProfileServiceTypes. Adapters do not need matching capabilities. A common arrangement is one adapter configured for AudioSink to serve a phone and another configured for AudioSource to serve a headset.

Everything downstream is keyed by adapter index: discovery sessions, paired device lists, profile service instances, and connection state. Two adapters operate simultaneously without interference.

Note

Configuration binds a profile set to an adapterIndex, which maps to an hci device path — not to a physical adapter address. If USB adapters re-enumerate, the paths can swap, and the profile sets swap with them. Where that matters, verify which physical adapter came up as which index at runtime rather than assuming.

Reading Configuration at Runtime

GetBluetoothConfiguration() returns the packaged configuration, which is the reliable way to discover how many adapters exist and what each can do:

var config = bluetoothClient.GetBluetoothConfiguration();

foreach (var adapter in config.AdapterConfigurations)
{
    Console.WriteLine($"Adapter {adapter.AdapterIndex} ({adapter.LocalName})");
    foreach (var profile in adapter.SupportedProfileServiceTypes)
        Console.WriteLine($"  {profile}");
}

Build your UI from this rather than hard-coding an adapter count or profile set. That is how the Classic demo produces one tab set per adapter with only the relevant panels in each.