• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 namespace bluetooth {
20 namespace sdp {
21 
22 enum class PduId : uint8_t {
23   RESERVED = 0x00,
24   ERROR = 0x01,
25   SERVICE_SEARCH_REQUEST = 0x02,
26   SERVICE_SEARCH_RESPONSE = 0x03,
27   SERVICE_ATTRIBUTE_REQUEST = 0x04,
28   SERVICE_ATTRIBUTE_RESPONSE = 0x05,
29   SERVICE_SEARCH_ATTRIBUTE_REQUEST = 0x06,
30   SERVICE_SEARCH_ATTRIBUTE_RESPONSE = 0x07,
31   MAX_VALUE = 0x07,
32 };
33 
34 enum class AttributeId : uint16_t {
35   SERVICE_RECORD_HANDLE = 0x0000,
36   SERVICE_CLASS_ID_LIST = 0x0001,
37   SERVICE_RECORD_STATE = 0x0002,
38   SERVICE_ID = 0x0003,
39   PROTOCOL_DESCRIPTOR_LIST = 0x0004,
40   BROWSE_GROUP_LIST = 0x0005,
41   LANGUAGE_BASE_ATTRIBUTE_ID_LIST = 0x0006,
42   SERVICE_INFO_TIME_TO_LIVE = 0x0007,
43   SERVICE_AVAILABILITY = 0x0008,
44   PROFILE_DESCRIPTOR_LIST = 0x0009,
45   DOCUMENTATION_URL = 0x000A,
46   CLIENT_EXECUTABLE_URL = 0x000B,
47   ICON_URL = 0x000C,
48   ADDITIONAL_PROTOCOL_DESCRIPTOR_LIST = 0x000D,
49 
50   // The following attributes are only used in the SDP server service record.
51   // They are only valid if ServiceDiscoveryServerServiceClassID is in the
52   // ServiceClassIDList. See Bluetooth Core v5.0 Section 5.2.
53   VERSION_NUMBER_LIST = 0x0200,
54   SERVICE_DATABASE_STATE = 0x0201,
55 };
56 
57 // The Attribute ID's of these attributes are calculated by adding the offset
58 // value for the attribute to the attribute ID base (contained in the
59 // LanguageBaseAttributeIDList attribute value).
60 enum AttributeIdOffset : uint16_t {
61   SERVICE_NAME = 0x0000,
62   SERVICE_DESCRIPTION = 0x0001,
63   PROVIDER_NAME = 0x0002,
64 };
65 
66 // Constant that define the different types of data element.
67 enum class DataElementType : uint8_t {
68   NIL = 0x00,
69   UNSIGNED_INT = 0x01,
70   SIGNED_INT = 0x02,
71   UUID = 0x03,
72   STRING = 0x04,
73   BOOLEAN = 0x05,
74   DATA_ELEMENT_SEQUENCE = 0x06,
75   DATA_ELEMENT_ALTERNATIVE = 0x07,
76   URL = 0x08,
77   MAX_VALUE = 0x08,
78 };
79 
80 // Constant that define the different sizes of data element.
81 enum class DataElementSize : uint8_t {
82   BYTE1 = 0x0,  // Exception: If the data element is NIL then size is 0 bytes
83   BYTE2 = 0x1,
84   BYTE4 = 0x2,
85   BYTE8 = 0x3,
86   BYTE16 = 0x4,
87   // The size types below represent that the first X bits of the value
88   // represents the size of the remaining data.
89   ADDITIONAL_8BIT = 0x5,
90   ADDITIONAL_16BIT = 0x6,
91   ADDITIONAL_32BIT = 0x7,
92 };
93 
94 }  // namespace sdp
95 }  // namespace bluetooth
96