| // Copyright 2018 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.bluetooth.bredr; |
| |
| using fuchsia.bluetooth; |
| using fuchsia.url; |
| |
| /// The maximum length that a sequence or set of alternatives supported in a |
| /// DataElement list. If a list is provided that is longer than this from a |
| /// peer, it is truncated. |
| const MAX_SEQUENCE_LENGTH uint8 = 255; |
| /// Maximum length of a string that is alowed in a DataElement. If a |
| /// DataElement string longer than this is sent by a peer it will be truncated. |
| const MAX_STRING_LENGTH uint16 = 1024; |
| |
| /// A DataElement is one element in a SDP record. SDP attributes and other parameters are |
| /// expresssed in DataElements. |
| type DataElement = strict union { |
| 1: int8 int8; |
| 2: int16 int16; |
| 3: int32 int32; |
| 4: int64 int64; |
| 5: uint8 uint8; |
| 6: uint16 uint16; |
| 7: uint32 uint32; |
| 8: uint64 uint64; |
| 9: str vector<uint8>:MAX_STRING_LENGTH; |
| 10: url fuchsia.url.Url; |
| 11: uuid fuchsia.bluetooth.Uuid; |
| 12: b bool; |
| 13: sequence vector<DataElement:optional>:MAX_SEQUENCE_LENGTH; |
| 14: alternatives vector<DataElement:optional>:MAX_SEQUENCE_LENGTH; |
| }; |
| |
| /// 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 |
| type ProtocolIdentifier = strict enum : uint16 { |
| SDP = 1; |
| RFCOMM = 3; |
| ATT = 7; |
| OBEX = 8; |
| BNEP = 15; |
| HIDP = 17; |
| HARDCOPY_CONTROL_CHANNEL = 18; |
| HARDCOPY_DATA_CHANNEL = 20; |
| HARDCOPY_NOTIFICATION = 22; |
| AVCTP = 23; |
| AVDTP = 25; |
| MCAP_CONTROL_CHANNEL = 30; |
| MCAP_DATA_CHANNEL = 31; |
| L2CAP = 256; |
| }; |
| |
| /// Defined PSMs from the Bluetooth Assigned Numbers |
| /// https://www.bluetooth.com/specifications/assigned-numbers/logical-link-control |
| /// Used in DataElement as protocol parameters for L2CAP. |
| const PSM_SDP uint16 = 1; |
| const PSM_RFCOMM uint16 = 3; |
| const PSM_TCSBIN uint16 = 5; // Telephony Control Specification |
| const PSM_TCSBIN_CORDLESS uint16 = 7; |
| const PSM_BNEP uint16 = 15; // Bluetooth Network Encapsulation Protocol |
| const PSM_HID_CONTROL uint16 = 17; // Human Interface Device |
| const PSM_HID_INTERRUPT uint16 = 19; // Human Interface Device |
| const PSM_AVCTP uint16 = 23; // Audio/Video Control Transport Protocol |
| const PSM_AVDTP uint16 = 25; // Audio/Video Distribution Transport Protocol |
| const PSM_AVCTP_BROWSE uint16 = 27; // Audio/Video Remote Control Profile (Browsing) |
| const PSM_ATT uint16 = 31; // ATT |
| const PSM_3DSP uint16 = 33; // 3D Synchronization Profile |
| const PSM_LE_IPSP uint16 = 35; // Internet Protocol Support Profile |
| const PSM_OTS uint16 = 37; // Object Transfer Service |
| |
| /// Identifies a communications protocol along with protocol-specific parameters. |
| /// Usually used to describe a protocol endpoint in a ProtocolDescriptorList |
| type ProtocolDescriptor = struct { |
| protocol ProtocolIdentifier; |
| params vector<DataElement>:MAX_SEQUENCE_LENGTH; |
| }; |
| |
| /// A ProtocolDescriptorList is a list of protocols in a "stack" from lowest to highest, |
| /// Specifying a specific protocol endpoint that can be connected. |
| alias ProtocolDescriptorList = vector<ProtocolDescriptor>:MAX_SEQUENCE_LENGTH; |
| |
| /// 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. |
| /// These numbers are sourced from the Bluetooth Assigned Numbers for SDP. |
| /// https://www.bluetooth.com/specifications/assigned-numbers/service-discovery |
| type ServiceClassProfileIdentifier = strict enum : uint16 { |
| // ServiceDiscoveryService and BrowseGroupDescriptorService claimed by Fuchsia |
| /// Serial Port Profile (SPP) |
| SERIAL_PORT = 0x1101; |
| // LANAccessUsingPPP omitted (deprecated) |
| /// Dial-up Networking Profile (DUN) |
| DIALUP_NETWORKING = 0x1103; |
| /// Object Push Profile (OPP) |
| OBEX_OBJECT_PUSH = 0x1105; |
| /// File Transfer Profile (FTP) |
| OPEX_FILE_TRANSFER = 0x1106; |
| /// Headset Profile (HSP) |
| HEADSET = 0x1108; |
| // CordlessTelephony (CTP) omitted (deprecated) |
| // Fax Profile (FAX) omitted (deprecated) |
| HEADSET_AUDIO_GATEWAY = 0x1112; |
| HEADSET_HS = 0x1131; |
| /// Advanced Audio Distribution Profile (A2DP) |
| AUDIO_SOURCE = 0x110A; |
| AUDIO_SINK = 0x110B; |
| ADVANCED_AUDIO_DISTRIBUTION = 0x110D; |
| /// Audio/Video Remote Control Profile (AVRCP) |
| AV_REMOTE_CONTROL_TARGET = 0x110C; |
| AV_REMOTE_CONTROL = 0x110E; |
| AV_REMOTE_CONTROL_CONTROLLER = 0x110F; |
| // Intercom (ICP) omitted (deprecated) |
| // Wap and Wap Client (WAP) omitted (deprecated) |
| // Synchronization Profile (SYNC) omitted (unsupported) |
| /// Personal Area Networking (PAN) |
| PANU = 0x1115; |
| NAP = 0x1116; |
| GN = 0x1117; |
| // Basic Printing and Basic Imaging Profiles omitted (unsupported) |
| /// Hands-Free Profile (HFP) |
| HANDSFREE = 0x111E; |
| HANDSFREE_AUDIO_GATEWAY = 0x111F; |
| /// Human Interface Device Profile (HID) |
| HUMAN_INTERFACE_DEVICE = 0x1124; |
| // Hardcopy Cable Replacement Profile omitted (unsupported) |
| /// Sim Access Profile (SAP) |
| SIM_ACCESS = 0x112D; |
| /// Phonebook Access Profile (PBAP) |
| PHONEBOOK_PCE = 0x112E; |
| PHONEBOOK_PSE = 0x112F; |
| PHONEBOOK = 0x1130; |
| /// Message Access Profile (MAP) |
| MESSAGE_ACCESS_SERVER = 0x1132; |
| MESSAGE_NOTIFICATION_SERVER = 0x1133; |
| MESSAGE_ACCESS_PROFILE = 0x1134; |
| // GNSS and 3DSP omitted (unsupported) |
| /// Multi-Profile Specification (MPS) |
| MPS_PROFILE = 0x113A; |
| MPS_CLASS = 0x113B; |
| // Calendar, Task, and Notes Profile omitted (unsupported) |
| /// Device Identification Profile (DI) |
| PNP_INFORMATION = 0x1200; |
| /// Generic Networking |
| GENERIC_NETWORKING = 0x1201; |
| /// Generic File Transfer |
| GENERIC_FILE_TRANSFER = 0x1202; |
| /// Generic Audio |
| GENERIC_AUDIO = 0x1203; |
| /// Generic Telephony |
| GENERIC_TELEPHONY = 0x1204; |
| // Enhanced Service Discovery Profile (ESDP) service classes omitted (deprecated). |
| /// Video Distribution Profile (VDP) |
| VIDEO_SOURCE = 0x1303; |
| VIDEO_SINK = 0x1304; |
| VIDEO_DISTRIBUTION = 0x1305; |
| /// Health Device Profile (HDP) |
| HDP = 0x1400; |
| HDP_SOURCE = 0x1401; |
| HDP_SINK = 0x1402; |
| }; |
| |
| /// A description of a profile that this service conforms to. |
| /// See Bluetooth Specification v5.2 Vol 3, Part B, Section 5.1.11 |
| type ProfileDescriptor = struct { |
| profile_id ServiceClassProfileIdentifier; |
| major_version uint8; |
| minor_version uint8; |
| }; |
| |
| /// Maximum number of languages that are supported by SDP at the moment. |
| // Note: all informations must be within 0x0100 - 0x01FF per Spec Vol 3, Part B, |
| // Sec 5.1.8. Since each information consumes three spaces, this means there is |
| // a max of 256 / 3 = 85 supported. |
| const MAX_INFORMATION_COUNT uint8 = 85; |
| |
| /// Human-readable information about a service. Strings are encoded in UTF-8. |
| /// See Bluetooth Specification v5.2 Vol 3, Part B, Sections 5.1.15 through 5.1.17 |
| type Information = table { |
| /// Language that the other fields in this table are in. |
| /// Must be two characters long and a valid ICO 639:1988 identifier. |
| /// Must be present. |
| 1: language string:2; |
| |
| /// Service name |
| 2: name string:MAX_STRING_LENGTH; |
| |
| /// A human-readable description |
| 3: description string:MAX_STRING_LENGTH; |
| |
| /// The provider of this service (person or organization) |
| 4: provider string:MAX_STRING_LENGTH; |
| }; |
| |
| /// A generic attribute, used for protocol information; |
| type Attribute = struct { |
| id uint16; |
| element DataElement; |
| }; |
| |
| /// Universal attribute IDs. |
| /// From the Bluetooth Specification v5.2, Vol 3, Part B |
| const ATTR_SERVICE_RECORD_HANDLE uint16 = 0x0000; |
| const ATTR_SERVICE_CLASS_ID_LIST uint16 = 0x0001; |
| const ATTR_SERVICE_RECORD_STATE uint16 = 0x0002; |
| const ATTR_SERVICE_ID uint16 = 0x0003; |
| const ATTR_PROTOCOL_DESCRIPTOR_LIST uint16 = 0x0004; |
| const ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LIST uint16 = 0x000D; |
| const ATTR_BROWSE_GROUP_LIST uint16 = 0x0005; |
| const ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST uint16 = 0x0006; |
| const ATTR_SERVICE_INFO_TIME_TO_LIVE uint16 = 0x0007; |
| const ATTR_SERVICE_AVAILABILITY uint16 = 0x0008; |
| const ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST uint16 = 0x0009; |
| |
| /// Maximum additional attributes as defined by the spec. All attributes |
| /// must be above 0x0200 per the Bluetooth Specfication, Ver 5.2 Vol 3, Part B, |
| /// Section 5 |
| const MAX_ADDITIONAL_ATTRIBUTES uint16 = 0xFDFF; |
| |
| /// Definition for a service that is to be advertised as available via Bluetooth BR/EDR. |
| type ServiceDefinition = table { |
| /// UUIDs of service classes that this service record conforms to. |
| /// This field is required - all advertised services must have at least one service class. |
| 1: service_class_uuids vector<fuchsia.bluetooth.Uuid>:MAX_SEQUENCE_LENGTH; |
| |
| /// Specification for the primary protocol that can be used to gain access to this |
| /// service, with their protocol-specific identifiers. |
| /// This is ordered from lowest level (typically L2CAP) to highest. |
| 2: protocol_descriptor_list ProtocolDescriptorList; |
| |
| /// Additional protocol descriptor lists, if the service requires more channels |
| /// in addition to the main service. |
| 3: additional_protocol_descriptor_lists vector<ProtocolDescriptorList>:MAX_SEQUENCE_LENGTH; |
| |
| /// Bluetooth profiles that are supported by this service. |
| 4: profile_descriptors vector<ProfileDescriptor>:MAX_SEQUENCE_LENGTH; |
| |
| /// Human-readable service information, in one or more languages. |
| /// The first set of information is considered the primary language. |
| 5: information vector<Information>:MAX_INFORMATION_COUNT; |
| |
| /// Additional attributes to be included in the Service Definition for specific |
| /// services or profiles. |
| /// All of these attributes should have an Attribute ID above 0x0200. |
| 6: additional_attributes vector<Attribute>:MAX_ADDITIONAL_ATTRIBUTES; |
| }; |