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

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

ProfileDescriptor

Defined in fuchsia.bluetooth.bredr/service.fidl

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

Information

Defined in fuchsia.bluetooth.bredr/service.fidl

NameTypeDescriptionDefault
language string No default
name string? No default
description string? No default
provider string? No default

Attribute

Defined in fuchsia.bluetooth.bredr/service.fidl

NameTypeDescriptionDefault
id uint16 No default
element DataElement No default

ServiceDefinition

Defined in fuchsia.bluetooth.bredr/service.fidl

NameTypeDescriptionDefault
service_class_uuids vector<string> No default
protocol_descriptors vector<ProtocolDescriptor> No default
additional_protocol_descriptors vector<vector>? No default
profile_descriptors vector<ProfileDescriptor> No default
information vector<Information> No default
additional_attributes vector<Attribute>? 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

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

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

NameValueDescription
SerialPort 4353
DialupNetworking 4355
ObexObjectPush 4357
ObexFileTransfer 4358
Headset 4360
HeadsetAudioGateway 4370
HeadsetHS 4401
AudioSource 4362
AudioSink 4363
AdvancedAudioDistribution 4365
AVRemoteControlTarget 4364
AVRemoteControl 4366
AVRemoteControlController 4367
PANU 4373
NAP 4374
GN 4375
Handsfree 4382
HandsfreeAudioGateway 4383
SIM_Access 4397
PhonebookPCE 4398
PhonebookPSE 4399
Phonebook 4400
MessageAccessServer 4402
MessageNotificationServer 4403
MessageAccessProfile 4404
MPSProfile 4410
MPSClass 4411
VideoSource 4867
VideoSink 4868
VideoDistribution 4869
HDP 5120
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
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
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