| // 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 uint8 MAX_SEQUENCE_LENGTH = 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 uint16 MAX_STRING_LENGTH = 1024; |
| |
| /// A DataElement is one element in a SDP record. SDP attributes and other parameters are |
| /// expresssed in DataElements. |
| union DataElement { |
| 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: string:MAX_STRING_LENGTH str; |
| 10: fuchsia.url.Url url; |
| 11: fuchsia.bluetooth.Uuid uuid; |
| 12: bool b; |
| 13: vector<DataElement?>:MAX_SEQUENCE_LENGTH sequence; |
| 14: vector<DataElement?>:MAX_SEQUENCE_LENGTH alternatives; |
| }; |
| |
| /// 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 |
| enum ProtocolIdentifier : 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 uint16 PSM_SDP = 1; |
| const uint16 PSM_RFCOMM = 3; |
| const uint16 PSM_TCSBIN = 5; // Telephony Control Specification |
| const uint16 PSM_TCSBIN_CORDLESS = 7; |
| const uint16 PSM_BNEP = 15; // Bluetooth Network Encapsulation Protocol |
| const uint16 PSM_HID_CONTROL = 17; // Human Interface Device |
| const uint16 PSM_HID_INTERRUPT = 19; // Human Interface Device |
| const uint16 PSM_AVCTP = 23; // Audio/Video Control Transport Protocol |
| const uint16 PSM_AVDTP = 25; // Audio/Video Distribution Transport Protocol |
| const uint16 PSM_AVCTP_BROWSE = 27; // Audio/Video Remote Control Profile (Browsing) |
| const uint16 PSM_ATT = 31; // ATT |
| const uint16 PSM_3DSP = 33; // 3D Synchronization Profile |
| const uint16 PSM_LE_IPSP = 35; // Internet Protocol Support Profile |
| const uint16 PSM_OTS = 37; // Object Transfer Service |
| |
| /// Identifies a communications protocol along with protocol-specific parameters. |
| /// Usually used to describe a protocol endpoint in a ProtocolDescriptorList |
| struct ProtocolDescriptor { |
| ProtocolIdentifier protocol; |
| vector<DataElement>:MAX_SEQUENCE_LENGTH params; |
| }; |
| |
| /// A ProtocolDescriptorList is a list of protocols in a "stack" from lowest to highest, |
| /// Specifying a specific protocol endpoint that can be connected. |
| using 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. |
| /// From Bluetooth Assigned Numbers for SDP |
| /// https://www.bluetooth.com/specifications/assigned-numbers/service-discovery |
| enum ServiceClassProfileIdentifier : uint16 { |
| /// ServiceDiscoveryService and BrowseGroupDescriptorService claimed by Fuchsia |
| SERIAL_PORT = 0x1101; // Serial Port Profile (SPP) |
| DIALUP_NETWORKING = 0x1103; // Dial-up Networking Profile (DUN) |
| OBEX_OBJECT_PUSH = 0x1105; // Object Push Profile (OPP) |
| OPEX_FILE_TRANSFER = 0x1106; // File Transfer Profile (FTP) |
| /// Headset Profile (HSP) |
| HEADSET = 0x1108; |
| 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; |
| /// 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 and Hardcopy Cable Replacement Profile omitted (unsupported) |
| SIM_ACCESS = 0x112D; // Sim Access Profile (SAP) |
| /// 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 ID used by Fuchsia |
| /// 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 |
| struct ProfileDescriptor { |
| ServiceClassProfileIdentifier profile_id; |
| uint8 major_version; |
| uint8 minor_version; |
| }; |
| |
| /// 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 uint8 MAX_INFORMATION_COUNT = 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 |
| table Information { |
| /// 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: string:2 language; |
| |
| /// Service name |
| 2: string:MAX_STRING_LENGTH name; |
| |
| /// A human-readable description |
| 3: string:MAX_STRING_LENGTH description; |
| |
| /// The provider of this service (person or organization) |
| 4: string:MAX_STRING_LENGTH provider; |
| }; |
| |
| /// A generic attribute, used for protocol information; |
| struct Attribute { |
| uint16 id; |
| DataElement element; |
| }; |
| |
| /// Universal attribute IDs. |
| /// From the Bluetooth Specification v5.2, Vol 3, Part B |
| const uint16 ATTR_SERVICE_RECORD_HANDLE = 0x0000; |
| const uint16 ATTR_SERVICE_CLASS_ID_LIST = 0x0001; |
| const uint16 ATTR_SERVICE_RECORD_STATE = 0x0002; |
| const uint16 ATTR_SERVICE_ID = 0x0003; |
| const uint16 ATTR_PROTOCOL_DESCRIPTOR_LIST = 0x0004; |
| const uint16 ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LIST = 0x000D; |
| const uint16 ATTR_BROWSE_GROUP_LIST = 0x0005; |
| const uint16 ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST = 0x0006; |
| const uint16 ATTR_SERVICE_INFO_TIME_TO_LIVE = 0x0007; |
| const uint16 ATTR_SERVICE_AVAILABILITY = 0x0008; |
| const uint16 ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST = 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 uint16 MAX_ADDITIONAL_ATTRIBUTES = 0xFDFF; |
| |
| /// Definition for a service that is to be advertised as available via Bluetooth BR/EDR. |
| table ServiceDefinition { |
| /// 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: vector<fuchsia.bluetooth.Uuid>:MAX_SEQUENCE_LENGTH service_class_uuids; |
| |
| /// 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: ProtocolDescriptorList protocol_descriptor_list; |
| |
| /// Additional protocol descriptor lists, if the service requires more channels |
| /// in addition to the main service. |
| 3: vector<ProtocolDescriptorList>:MAX_SEQUENCE_LENGTH additional_protocol_descriptor_lists; |
| |
| /// Bluetooth profiles that are supported by this service. |
| 4: vector<ProfileDescriptor>:MAX_SEQUENCE_LENGTH profile_descriptors; |
| |
| /// Human-readable service information, in one or more languages. |
| /// The first set of information is considered the primary language. |
| 5: vector<Information>:MAX_INFORMATION_COUNT information; |
| |
| /// 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: vector<Attribute>:MAX_ADDITIONAL_ATTRIBUTES additional_attributes; |
| }; |