blob: 7e3a0557c4e24742a3b8ee479b28e9b16d02fcf6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
# Copyright 2023 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
# This file contains Emboss packet definitions for extensions to the Bluetooth
# Host-Controller interface. These extensions are not standardized through the
# Bluetooth SIG.
#
# NOTE: The definitions below are incomplete. They get added as needed.
# This list will grow as we support more vendor features.
import "hci_common.emb" as hci
[$default byte_order: "LittleEndian"]
[(cpp) namespace: "pw::bluetooth::vendor::android_hci"]
# ========================= HCI packet headers ==========================
struct AndroidCommandHeader:
-- HCI Vendor Command packet header.
let hdr_size = hci.CommandHeader.$size_in_bytes
0 [+hdr_size] hci.CommandHeader header
$next [+1] UInt sub_opcode
# ======================= Android HCI extensions ========================
# Documentation: https://source.android.com/devices/bluetooth/hci_requirements
enum Capability:
[maximum_bits: 8]
NOT_CAPABLE = 0x00
CAPABLE = 0x01
bits AudioCodecSupportMask:
0 [+1] Flag sbc
1 [+1] Flag aac
2 [+1] Flag aptx
3 [+1] Flag aptx_hd
4 [+1] Flag ldac
enum A2dpCodecType:
[maximum_bits: 8]
SBC = 0x01
AAC = 0x02
APTX = 0x04
APTX_HD = 0x08
LDAC = 0x10
struct A2dpScmsTEnable:
0 [+1] hci.GenericEnableParam enabled
$next [+1] UInt header
enum A2dpSamplingFrequency:
[maximum_bits: 8]
HZ_44100 = 0x01
HZ_48000 = 0x02
HZ_88200 = 0x04
HZ_96000 = 0x08
enum A2dpBitsPerSample:
[maximum_bits: 8]
BITS_PER_SAMPLE_16 = 0x01
BITS_PER_SAMPLE_24 = 0x02
BITS_PER_SAMPLE_32 = 0x04
enum A2dpChannelMode:
[maximum_bits: 8]
MONO = 0x01
STEREO = 0x02
enum SbcSamplingFrequency:
[maximum_bits: 4]
HZ_48000 = 0x01
HZ_44100 = 0x02
HZ_32000 = 0x04
HZ_16000 = 0x08
enum SbcChannelMode:
[maximum_bits: 4]
JOINT_STEREO = 0x01
STEREO = 0x02
DUAL_CHANNEL = 0x04
MONO = 0x08
enum SbcBlockLen:
[maximum_bits: 4]
BLOCK_LEN_16 = 0x01
BLOCK_LEN_12 = 0x02
BLOCK_LEN_8 = 0x04
BLOCK_LEN_4 = 0x08
enum SbcSubBands:
[maximum_bits: 2]
SUBBANDS_8 = 0x01
SUBBANDS_4 = 0x02
enum SbcAllocationMethod:
[maximum_bits: 2]
LOUNDNESS = 0x01
SNR = 0x02
enum AacEnableVariableBitRate:
-- 1-octet boolean "enable"/"disable" parameter for AAC variable bitrate
[maximum_bits: 8]
DISABLE = 0x00
ENABLE = 0x80
enum LdacBitrateIndex:
-- Values 0x03 - 0x7E are reserved
-- Values 0x80 - 0xFF are reserved
[maximum_bits: 8]
HIGH = 0x00
MID = 0x01
LOW = 0x02
ADAPTIVE_BITRATE = 0x7F
bits LdacChannelMode:
-- Bitmask values for LDAC Channel Mode
0 [+1] Flag stereo
1 [+1] Flag dual
2 [+1] Flag mono
struct SbcCodecInformation:
0 [+1] bits:
0 [+2] SbcAllocationMethod allocation_method
$next [+2] SbcSubBands subbands
$next [+4] SbcBlockLen block_length
$next [+1] UInt min_bitpool_value
$next [+1] UInt max_bitpool_value
$next [+1] bits:
0 [+4] SbcChannelMode channel_mode
$next [+4] SbcSamplingFrequency sampling_frequency
$next [+28] UInt:8[28] reserved
struct AacCodecInformation:
0 [+1] UInt object_type
$next [+1] AacEnableVariableBitRate variable_bit_rate
$next [+30] UInt:8[30] reserved
struct LdacCodecInformation:
0 [+4] UInt vendor_id
-- Must always be set to kLdacVendorId
$next [+2] UInt codec_id
-- Must always be set to kLdacCodecId
-- All other values are reserved
$next [+1] LdacBitrateIndex bitrate_index
-- See enum class LdacBitrateIndex in this file for possible values
$next [+1] bits:
0 [+3] LdacChannelMode ldac_channel_mode
-- Bitmask: LDAC channel mode (see LdacChannelMode for bitmask values)
$next [+24] UInt:8[24] reserved
# ============ Commands ============
struct StartA2dpOffloadCommand:
let vendor_size = AndroidCommandHeader.$size_in_bytes
0 [+vendor_size] AndroidCommandHeader vendor_command
$next [+4] bits:
0 [+8] A2dpCodecType codec_type
-- See enum class A2dpCodecType in this file for possible values
$next [+2] UInt max_latency
-- Max latency allowed in ms. A value of zero disables flush.
$next [+2] A2dpScmsTEnable scms_t_enable
$next [+4] bits:
0 [+8] A2dpSamplingFrequency sampling_frequency
-- See enum class A2dpSamplingFrequency in this file for possible values
$next [+1] A2dpBitsPerSample bits_per_sample
-- See enum class A2dpBitsPerSample in this file for possible values
$next [+1] A2dpChannelMode channel_mode
-- See enum class A2dpChannelMode in this file for possible values
$next [+4] UInt encoded_audio_bitrate
-- The encoded audio bitrate in bits per second
-- 0x00000000 - The audio bitrate is not specified / unused
-- 0x00000001 - 0x00FFFFFF - Encoded audio bitrate in bits per second
-- 0x01000000 - 0xFFFFFFFF - Reserved
[requires: 0x00000000 <= this <= 0x00FFFFFF]
$next [+2] UInt connection_handle
-- Connection handle of A2DP connection being configured (only the lower 12-bits are meaningful)
-- Range: 0x0000 to 0x0EFF
[requires: 0x0000 <= this <= 0x0EFF]
$next [+2] UInt l2cap_channel_id
-- L2CAP channel ID to be used for this A2DP connection
$next [+2] UInt l2cap_mtu_size
-- Maximum size of L2CAP MTU containing encoded audio packets
if codec_type == A2dpCodecType.SBC:
28 [+32] SbcCodecInformation sbc_codec_information
if codec_type == A2dpCodecType.AAC:
28 [+32] AacCodecInformation aac_codec_information
if codec_type == A2dpCodecType.LDAC:
28 [+32] LdacCodecInformation ldac_codec_information
if codec_type == A2dpCodecType.APTX || codec_type == A2dpCodecType.APTX_HD:
28 [+32] UInt:8[32] reserved
struct StopA2dpOffloadCommand:
let vendor_size = AndroidCommandHeader.$size_in_bytes
0 [+vendor_size] AndroidCommandHeader vendor_command
struct LEMultiAdvtEnableCommand:
-- LE multi-advertising enable command.
let vendor_size = AndroidCommandHeader.$size_in_bytes
0 [+vendor_size] AndroidCommandHeader vendor_command
$next [+1] hci.GenericEnableParam enable
$next [+1] UInt advertising_handle
struct LEGetVendorCapabilitiesCommand:
let hdr_size = hci.CommandHeader.$size_in_bytes
0 [+hdr_size] hci.CommandHeader header
# ============ Events ============
struct LEMultiAdvtStateChangeSubevent:
-- LE multi-advertising state change subevent.
0 [+hci.VendorDebugEvent.$size_in_bytes] hci.VendorDebugEvent vendor_event
$next [+1] UInt advertising_handle
-- Handle used to identify an advertising set.
$next [+1] hci.StatusCode status
-- Reason for state change. Currently will always be 0x00.
-- 0x00: Connection received.
$next [+2] UInt connection_handle
-- Handle used to identify the connection that caused the state change (i.e.
-- advertising instance to be disabled). Value will be 0xFFFF if invalid.
struct LEGetVendorCapabilitiesCommandCompleteEvent:
let hdr_size = hci.CommandCompleteEvent.$size_in_bytes
0 [+hdr_size] hci.CommandCompleteEvent command_complete
$next [+1] hci.StatusCode status
$next [+1] UInt max_advt_instances
-- Number of advertisement instances supported
-- Deprecated in Google feature spec v0.98 and higher
$next [+1] Capability offloaded_resolution_of_private_address
-- BT chip capability of RPA
-- Deprecated in Google feature spec v0.98 and higher
$next [+2] UInt total_scan_results_storage
-- Storage for scan results in bytes
$next [+1] UInt max_irk_list_sz
-- Number of IRK entries supported in the firmware
$next [+1] Capability filtering_support
-- Support for filtering in the controller
$next [+1] UInt max_filter
-- Number of filters supported
$next [+1] Capability activity_energy_info_support
-- Supports reporting of activity and energy information
$next [+2] bits version_supported:
-- Specifies the version of the Google feature spec supported
0 [+8] UInt major_number
$next [+8] UInt minor_number
$next [+2] UInt total_num_of_advt_tracked
-- Total number of advertisers tracked for OnLost/OnFound purposes
$next [+1] Capability extended_scan_support
-- Supports extended scan window and interval
$next [+1] Capability debug_logging_supported
-- Supports logging of binary debug information from controller
$next [+1] Capability le_address_generation_offloading_support
-- Deprecated in Google feature spec v0.98 and higher
$next [+4] bits:
0 [+5] AudioCodecSupportMask a2dp_source_offload_capability_mask
$next [+1] Capability bluetooth_quality_report_support
-- Supports reporting of Bluetooth Quality events
$next [+4] bits:
0 [+5] AudioCodecSupportMask dynamic_audio_buffer_support
|