fuchsia.bluetooth.bredr

PROTOCOLS

Profile

Defined in fuchsia.bluetooth.bredr/profile.fidl

Profile provides Bluetooth services a way to register a service definition, making that service discoverable by remote peers. Registered services will receive L2CAP connections made to the services advertised in the definition, and can open connections to remote connected devices. To discover possible connected devices, devices should use AddSearch to search any remote devices.

AddService

Register a service. This service will be registered and discoverable with the Service Discovery Protocol server. The security_level provided here will be required before a connection is established. If devices is true, connections to the service's channels will create a device instead of producing an OnConnected event. Returns status for success or error. If successful, a unique service_id is returned to identify this service.

Request

NameType
definition ServiceDefinition
sec_level SecurityLevel
devices bool

Response

NameType
status fuchsia.bluetooth/Status
service_id uint64

AddSearch

Register a search for services on remote devices. An OnServiceFound event will be produced each time a device is connected that has a service matching service_uuid with the additional attributes in attr_ids. The ProtocolDescriptor should be requested to obtain information to connect to a service. If attr_ids is empty, all attributes will be requested. See the SDP Specification (Core Spec 5.0, Vol 3, Part B, Section 5) and the relevant profile specification documents.

Request

NameType
service_uuid ServiceClassProfileIdentifier
attr_ids vector<uint16>

RemoveService

Removes a previously-registered service, disconnecting all clients.

Request

NameType
service_id uint64

ConnectL2cap

Connect a channel to the connected remote device peer_id using the protocol and channel listed. For L2CAP, dynamic PSMs can be specified. See the defined PSMs in service.fidl Returns the channel after it has been connected. status will indicate an error if the channel could not be connected.

Request

NameType
peer_id string
psm uint16

Response

NameType
status fuchsia.bluetooth/Status
channel handle<socket>?

OnConnected

Produced when a protocol channel is connected for this profile. channel contains the channel connected to, and information about the protocol is provided in protocol. All protocols supported internally will be handled, for example an RFCOMM socket will be provided instead of an L2CAP socket if the services protocol descriptor includes it.

Response

NameType
device_id string
service_id uint64
channel handle<socket>
protocol ProtocolDescriptor

OnServiceFound

Produced when a search this client added finds a matching service on a remote device. peer_id is the device the service was found on, and profile includes the Profile Descriptor which matches the service_uuid searched for, with the major and minor version reported by the remote device. attributes contains all attributes retrieved from the remote device. It may include attributes not requested in the search.

Response

NameType
peer_id string
profile ProfileDescriptor
attributes vector<Attribute>

STRUCTS

DataElement

Defined in fuchsia.bluetooth.bredr/service.fidl

NameTypeDescriptionDefault
type DataElementType No default
size uint32 No default
data DataElementData No default

ProtocolDescriptor

Defined in fuchsia.bluetooth.bredr/service.fidl

Identifies a communications protocol along with protocol-specific parameters.

NameTypeDescriptionDefault
protocol ProtocolIdentifier No default
params vector<DataElement> No default

ProfileDescriptor

Defined in fuchsia.bluetooth.bredr/service.fidl

A description of a profile that this service conforms to.

NameTypeDescriptionDefault
profile_id ServiceClassProfileIdentifier No default
major_version uint8 No default
minor_version uint8 No default

Information

Defined in fuchsia.bluetooth.bredr/service.fidl

Human-readable information about a service. Strings are encoded in UTF-8.

NameTypeDescriptionDefault
language string Language that is represented. Must be two characters long and a valid ICO 639:1988 identifier. No default
name string? Service name No default
description string? A human-readable description No default
provider string? The provider of this service (person or organization) No default

Attribute

Defined in fuchsia.bluetooth.bredr/service.fidl

A generic attribute, used for protocol information;

NameTypeDescriptionDefault
id uint16 No default
element DataElement No default

ServiceDefinition

Defined in fuchsia.bluetooth.bredr/service.fidl

NameTypeDescriptionDefault
service_class_uuids vector<string> UUIDs of service classes that this service record conforms to. No default
protocol_descriptors vector<ProtocolDescriptor> The protocols that can be used to gain access to this service, with their protocol-specific identifiers. This is ordered from lowest level to highest. No default
additional_protocol_descriptors vector<vector>? Additional protocol descriptor lists, if the service requires more channels in addition to the main service. No default
profile_descriptors vector<ProfileDescriptor> Bluetooth profiles that are supported by this service. No default
information vector<Information> Human-readable service information, in one or more languages. The first set of information is considered the primary language. No default
additional_attributes vector<Attribute>? Additional attributes included in the Service Definition, for specific services. All of these attributes should have an Attribute ID above 0x0200. No default

ENUMS

SecurityLevel

Type: uint32

Defined in fuchsia.bluetooth.bredr/profile.fidl

NameValueDescription
NONE 0
ENCRYPTION_OPTIONAL 1
ENCRYPTION_REQUIRED 2
MITM_PROTECTED 3
HIGH_STRENGTH 4

DataElementType

Type: uint32

Defined in fuchsia.bluetooth.bredr/service.fidl

A building element in SDP. Used for various low-level and custom parameters.

NameValueDescription
NOTHING 0
UNSIGNED_INTEGER 1
SIGNED_INTEGER 2
UUID 3
STRING 4
BOOLEAN 5
SEQUENCE 6
ALTERNATIVE 7

ProtocolIdentifier

Type: uint16

Defined in fuchsia.bluetooth.bredr/service.fidl

Defined Protocol Identifiers for the Protocol Descriptor We intentionally omit deprecated profile identifiers. From Bluetooth Assigned Numbers: https://www.bluetooth.com/specifications/assigned-numbers/service-discovery

NameValueDescription
SDP 1
RFCOMM 3
ATT 7
OBEX 8
BNEP 15
HIDP 17
HardcopyControlChannel 18
HardcopyDataChannel 20
HardcopyNotification 22
AVCTP 23
AVDTP 25
MCAPControlChannel 30
MCAPDataChannel 31
L2CAP 256

ServiceClassProfileIdentifier

Type: uint32

Defined in fuchsia.bluetooth.bredr/service.fidl

Identifiers that are valid for Bluetooth Classes / Profiles We intentionally omit classes and profile IDs that are unsupported, deprecated, or reserved for use by Fuchsia Bluetooth. From Bluetooth Assigned Numbers for SDP https://www.bluetooth.com/specifications/assigned-numbers/service-discovery

NameValueDescription
SerialPort 4353 ServiceDiscoveryService and BrowseGroupDescriptorService used by Fuchsia
DialupNetworking 4355
ObexObjectPush 4357
ObexFileTransfer 4358
Headset 4360 Headset Profile (HSP)
HeadsetAudioGateway 4370
HeadsetHS 4401
AudioSource 4362 Advanced Audio Distribution Profile (A2DP)
AudioSink 4363
AdvancedAudioDistribution 4365
AVRemoteControlTarget 4364 Audio/Video Remote Control Profil (AVRCP)
AVRemoteControl 4366
AVRemoteControlController 4367
PANU 4373 Personal Area Networking (PAN)
NAP 4374
GN 4375
Handsfree 4382 Basic Printing and Basic Imaging Profiles omitted (unsupported) Hands-Free Profile (HFP)
HandsfreeAudioGateway 4383
SIM_Access 4397 Human Interface Device and Hardcopy Cable Replacement Profile omitted (unsupported)
PhonebookPCE 4398 Phonebook Access Profile (PBAP)
PhonebookPSE 4399
Phonebook 4400
MessageAccessServer 4402 Message Access Profile (MAP)
MessageNotificationServer 4403
MessageAccessProfile 4404
MPSProfile 4410 GNSS and 3DSP omitted (unsupported) Multi-Profile Specification (MPS)
MPSClass 4411
VideoSource 4867 Calendar, Task, and Notes Profile omitted (unsupported) Device ID used by Fuchsia Video Distribution Profile (VDP)
VideoSink 4868
VideoDistribution 4869
HDP 5120 Health Device Profile (HDP)
HDPSource 5121
HDPSink 5122

UNIONS

DataElementData

Defined in fuchsia.bluetooth.bredr/service.fidl

NameTypeDescription
integer int64
str string?
uuid string?
b bool
bytes vector<uint8>?
sequence vector<DataElement>

CONSTANTS

NameValueTypeDescription
kPSM_SDP 1 int64 Defined PSMs from the Bluetooth Assigned Numbers https://www.bluetooth.com/specifications/assigned-numbers/logical-link-control Used in DataElementData for protocol parameters for L2CAP.
kPSM_RFCOMM 3 int64
kPSM_TCSBIN 5 int64
kPSM_TCSBINCordless 7 int64
kPSM_BNEP 15 int64
kPSM_HIDControl 17 int64
kPSM_HIDInterrupt 19 int64
kPSM_AVCTP 23 int64
kPSM_AVDTP 25 int64
kPSM_AVCTP_Browse 27 int64
kPSM_ATT 31 int64
kPSM_3DSP 33 int64
kPSM_LE_IPSP 35 int64
kPSM_OTS 37 int64
ATTR_SERVICE_RECORD_HANDLE 0 uint16 Universal attribute IDs. From the Bluetooth Specification, Version 5, Vol 3, Part B
ATTR_SERVICE_CLASS_ID_LIST 1 uint16
ATTR_SERVICE_RECORD_STATE 2 uint16
ATTR_SERVICE_ID 3 uint16
ATTR_PROTOCOL_DESCRIPTOR_LIST 4 uint16
ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LIST 13 uint16
ATTR_BROWSE_GROUP_LIST 5 uint16
ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST 6 uint16
ATTR_SERVICE_INFO_TIME_TO_LIVE 7 uint16
ATTR_SERVICE_AVAILABILITY 8 uint16
ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST 9 uint16