• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14 
15 #pragma once
16 #include <pw_bluetooth/hci_common.emb.h>
17 #include <pw_bluetooth/hci_events.emb.h>
18 
19 #include <array>
20 #include <cstdint>
21 
22 #include "pw_bluetooth_sapphire/internal/host/common/device_address.h"
23 #include "pw_bluetooth_sapphire/internal/host/common/device_class.h"
24 #include "pw_bluetooth_sapphire/internal/host/common/macros.h"
25 #include "pw_bluetooth_sapphire/internal/host/common/uint128.h"
26 #include "pw_bluetooth_sapphire/internal/host/hci-spec/constants.h"
27 
28 // This file contains general opcode/number and static packet definitions for
29 // the Bluetooth Host-Controller Interface. Each packet payload structure
30 // contains parameter descriptions based on their respective documentation in
31 // the Bluetooth Core Specification version 5.0
32 //
33 // NOTE: Avoid casting raw buffer pointers to the packet payload structure types
34 // below; use as template parameter to PacketView::payload(), or
35 // MutableBufferView::mutable_payload() instead. Take extra care when accessing
36 // flexible array members.
37 
38 namespace bt::hci_spec {
39 
40 using pw::bluetooth::emboss::ConnectionRole;
41 using pw::bluetooth::emboss::GenericEnableParam;
42 using pw::bluetooth::emboss::StatusCode;
43 
44 // HCI opcode as used in command packets.
45 using OpCode = uint16_t;
46 
47 // HCI event code as used in event packets.
48 using EventCode = uint8_t;
49 
50 // Data Connection Handle used for ACL and SCO logical link connections.
51 using ConnectionHandle = uint16_t;
52 
53 // Handle used to identify an advertising set used in the 5.0 Extended
54 // Advertising feature.
55 using AdvertisingHandle = uint8_t;
56 
57 // Handle used to identify a periodic advertiser used in the 5.0 Periodic
58 // Advertising feature.
59 using PeriodicAdvertiserHandle = uint16_t;
60 
61 // Uniquely identifies a CIG (Connected Isochronous Group) in the context of an
62 // LE connection.
63 using CigIdentifier = uint8_t;
64 
65 // Uniquely identifies a CIS (Connected Isochronous Stream) in the context of a
66 // CIG and an LE connection.
67 using CisIdentifier = uint8_t;
68 
69 // Returns the OGF (OpCode Group Field) which occupies the upper 6-bits of the
70 // opcode.
GetOGF(const OpCode opcode)71 inline uint8_t GetOGF(const OpCode opcode) { return opcode >> 10; }
72 
73 // Returns the OCF (OpCode Command Field) which occupies the lower 10-bits of
74 // the opcode.
GetOCF(const OpCode opcode)75 inline uint16_t GetOCF(const OpCode opcode) { return opcode & 0x3FF; }
76 
77 // Returns the opcode based on the given OGF and OCF fields.
DefineOpCode(const uint8_t ogf,const uint16_t ocf)78 constexpr OpCode DefineOpCode(const uint8_t ogf, const uint16_t ocf) {
79   return static_cast<uint16_t>(((ogf & 0x3F) << 10) | (ocf & 0x03FF));
80 }
81 
82 // ========================= HCI packet headers ==========================
83 // NOTE(armansito): The definitions below are incomplete since they get added as
84 // needed. This list will grow as we support more features.
85 
86 struct CommandHeader {
87   uint16_t opcode;
88   uint8_t parameter_total_size;
89 } __attribute__((packed));
90 
91 struct ACLDataHeader {
92   // The first 16-bits contain the following fields, in order:
93   //   - 12-bits: Connection Handle
94   //   - 2-bits: Packet Boundary Flags
95   //   - 2-bits: Broadcast Flags
96   uint16_t handle_and_flags;
97 
98   // Length of data following the header.
99   uint16_t data_total_length;
100 } __attribute__((packed));
101 
102 struct SynchronousDataHeader {
103   // The first 16-bits contain the following fields, in order:
104   // - 12-bits: Connection Handle
105   // - 2-bits: Packet Status Flag
106   // - 2-bits: RFU
107   uint16_t handle_and_flags;
108 
109   // Length of the data following the header.
110   uint8_t data_total_length;
111 } __attribute__((packed));
112 
113 // ============= HCI Command and Event (op)code and payloads =============
114 
115 // No-Op
116 inline constexpr OpCode kNoOp = 0x0000;
117 
118 // The following is a list of HCI command and event declarations sorted by OGF
119 // category. Within each category the commands are sorted by their OCF. Each
120 // declaration is preceded by the name of the command or event followed by the
121 // Bluetooth Core Specification version in which it was introduced. Commands
122 // that apply to a specific Bluetooth sub-technology
123 // (e.g. BR/EDR, LE, AMP) will also contain that definition.
124 //
125 // NOTE(armansito): This list is incomplete. Entries will be added as needed.
126 
127 // ======= Link Control Commands =======
128 // Core Spec v5.0, Vol 2, Part E, Section 7.1
129 inline constexpr uint8_t kLinkControlOGF = 0x01;
LinkControlOpCode(const uint16_t ocf)130 constexpr OpCode LinkControlOpCode(const uint16_t ocf) {
131   return DefineOpCode(kLinkControlOGF, ocf);
132 }
133 
134 // ===============================
135 // Inquiry Command (v1.1) (BR/EDR)
136 inline constexpr OpCode kInquiry = LinkControlOpCode(0x0001);
137 
138 // ======================================
139 // Inquiry Cancel Command (v1.1) (BR/EDR)
140 inline constexpr OpCode kInquiryCancel = LinkControlOpCode(0x0002);
141 
142 // Inquiry Cancel Command has no command parameters.
143 
144 // =================================
145 // Create Connection (v1.1) (BR/EDR)
146 inline constexpr OpCode kCreateConnection = LinkControlOpCode(0x0005);
147 
148 // =======================================
149 // Disconnect Command (v1.1) (BR/EDR & LE)
150 inline constexpr OpCode kDisconnect = LinkControlOpCode(0x0006);
151 
152 // ========================================
153 // Create Connection Cancel (v1.1) (BR/EDR)
154 inline constexpr OpCode kCreateConnectionCancel = LinkControlOpCode(0x0008);
155 
156 // =========================================
157 // Accept Connection Request (v1.1) (BR/EDR)
158 inline constexpr OpCode kAcceptConnectionRequest = LinkControlOpCode(0x0009);
159 
160 // =========================================
161 // Reject Connection Request (v1.1) (BR/EDR)
162 inline constexpr OpCode kRejectConnectionRequest = LinkControlOpCode(0x000A);
163 
164 // ==============================================
165 // Link Key Request Reply Command (v1.1) (BR/EDR)
166 inline constexpr OpCode kLinkKeyRequestReply = LinkControlOpCode(0x000B);
167 
168 inline constexpr size_t kBrEdrLinkKeySize = 16;
169 
170 // =======================================================
171 // Link Key Request Negative Reply Command (v1.1) (BR/EDR)
172 inline constexpr OpCode kLinkKeyRequestNegativeReply =
173     LinkControlOpCode(0x000C);
174 
175 // =======================================================
176 // PIN Code Request Reply Command (v1.1) (BR/EDR)
177 inline constexpr OpCode kPinCodeRequestReply = LinkControlOpCode(0x000D);
178 
179 // =======================================================
180 // PIN Code Request Negative Reply Command (v1.1) (BR/EDR)
181 inline constexpr OpCode kPinCodeRequestNegativeReply =
182     LinkControlOpCode(0x000E);
183 
184 // ================================================
185 // Authentication Requested Command (v1.1) (BR/EDR)
186 inline constexpr OpCode kAuthenticationRequested = LinkControlOpCode(0x0011);
187 
188 // =================================================
189 // Set Connection Encryption Command (v1.1) (BR/EDR)
190 inline constexpr OpCode kSetConnectionEncryption = LinkControlOpCode(0x0013);
191 
192 // ============================================================
193 // Remote Name Request Command (v1.1) (BR/EDR)
194 inline constexpr OpCode kRemoteNameRequest = LinkControlOpCode(0x0019);
195 
196 // ======================================================
197 // Read Remote Supported Features Command (v1.1) (BR/EDR)
198 inline constexpr OpCode kReadRemoteSupportedFeatures =
199     LinkControlOpCode(0x001B);
200 
201 // =====================================================
202 // Read Remote Extended Features Command (v1.2) (BR/EDR)
203 inline constexpr OpCode kReadRemoteExtendedFeatures = LinkControlOpCode(0x001C);
204 
205 // ============================================================
206 // Read Remote Version Information Command (v1.1) (BR/EDR & LE)
207 inline constexpr OpCode kReadRemoteVersionInfo = LinkControlOpCode(0x001D);
208 
209 // =============================================
210 // Reject Synchronous Connection Command (BR/EDR)
211 inline constexpr OpCode kRejectSynchronousConnectionRequest =
212     LinkControlOpCode(0x002A);
213 
214 // =========================================================
215 // IO Capability Request Reply Command (v2.1 + EDR) (BR/EDR)
216 inline constexpr OpCode kIOCapabilityRequestReply = LinkControlOpCode(0x002B);
217 
218 // =============================================================
219 // User Confirmation Request Reply Command (v2.1 + EDR) (BR/EDR)
220 inline constexpr OpCode kUserConfirmationRequestReply =
221     LinkControlOpCode(0x002C);
222 
223 // ======================================================================
224 // User Confirmation Request Negative Reply Command (v2.1 + EDR) (BR/EDR)
225 inline constexpr OpCode kUserConfirmationRequestNegativeReply =
226     LinkControlOpCode(0x002D);
227 
228 // ========================================================
229 // User Passkey Request Reply Command (v2.1 + EDR) (BR/EDR)
230 inline constexpr OpCode kUserPasskeyRequestReply = LinkControlOpCode(0x002E);
231 
232 // =================================================================
233 // User Passkey Request Negative Reply Command (v2.1 + EDR) (BR/EDR)
234 inline constexpr OpCode kUserPasskeyRequestNegativeReply =
235     LinkControlOpCode(0x002F);
236 
237 // ==================================================================
238 // IO Capability Request Negative Reply Command (v2.1 + EDR) (BR/EDR)
239 inline constexpr OpCode kIOCapabilityRequestNegativeReply =
240     LinkControlOpCode(0x0034);
241 
242 // ======================================================
243 // Enhanced Setup Synchronous Connection Command (BR/EDR)
244 inline constexpr OpCode kEnhancedSetupSynchronousConnection =
245     LinkControlOpCode(0x003D);
246 
247 // ===============================================================
248 // Enhanced Accept Synchronous Connection Request Command (BR/EDR)
249 inline constexpr OpCode kEnhancedAcceptSynchronousConnectionRequest =
250     LinkControlOpCode(0x003E);
251 
252 // ======= Controller & Baseband Commands =======
253 // Core Spec v5.0 Vol 2, Part E, Section 7.3
254 inline constexpr uint8_t kControllerAndBasebandOGF = 0x03;
ControllerAndBasebandOpCode(const uint16_t ocf)255 constexpr OpCode ControllerAndBasebandOpCode(const uint16_t ocf) {
256   return DefineOpCode(kControllerAndBasebandOGF, ocf);
257 }
258 
259 // =============================
260 // Set Event Mask Command (v1.1)
261 inline constexpr OpCode kSetEventMask = ControllerAndBasebandOpCode(0x0001);
262 
263 // ====================
264 // Reset Command (v1.1)
265 inline constexpr OpCode kReset = ControllerAndBasebandOpCode(0x0003);
266 
267 // ========================================
268 // Read PIN Type Command (v1.1) (BR/EDR)
269 inline constexpr OpCode kReadPinType = ControllerAndBasebandOpCode(0x0009);
270 
271 // ========================================
272 // Write PIN Type Command (v1.1) (BR/EDR)
273 inline constexpr OpCode kWritePinType = ControllerAndBasebandOpCode(0x000A);
274 
275 // ========================================
276 // Write Local Name Command (v1.1) (BR/EDR)
277 inline constexpr OpCode kWriteLocalName = ControllerAndBasebandOpCode(0x0013);
278 
279 // =======================================
280 // Read Local Name Command (v1.1) (BR/EDR)
281 inline constexpr OpCode kReadLocalName = ControllerAndBasebandOpCode(0x0014);
282 
283 // ==========================================
284 // Write Page Timeout Command (v1.1) (BR/EDR)
285 inline constexpr OpCode kWritePageTimeout = ControllerAndBasebandOpCode(0x0018);
286 
287 // ========================================
288 // Read Scan Enable Command (v1.1) (BR/EDR)
289 inline constexpr OpCode kReadScanEnable = ControllerAndBasebandOpCode(0x0019);
290 
291 // =========================================
292 // Write Scan Enable Command (v1.1) (BR/EDR)
293 inline constexpr OpCode kWriteScanEnable = ControllerAndBasebandOpCode(0x001A);
294 
295 // ===============================================
296 // Read Page Scan Activity Command (v1.1) (BR/EDR)
297 inline constexpr OpCode kReadPageScanActivity =
298     ControllerAndBasebandOpCode(0x001B);
299 
300 // ================================================
301 // Write Page Scan Activity Command (v1.1) (BR/EDR)
302 inline constexpr OpCode kWritePageScanActivity =
303     ControllerAndBasebandOpCode(0x001C);
304 
305 // ===============================================
306 // Read Inquiry Scan Activity Command (v1.1) (BR/EDR)
307 inline constexpr OpCode kReadInquiryScanActivity =
308     ControllerAndBasebandOpCode(0x001D);
309 
310 // ================================================
311 // Write Inquiry Scan Activity Command (v1.1) (BR/EDR)
312 inline constexpr OpCode kWriteInquiryScanActivity =
313     ControllerAndBasebandOpCode(0x001E);
314 
315 // ============================================
316 // Read Class of Device Command (v1.1) (BR/EDR)
317 inline constexpr OpCode kReadClassOfDevice =
318     ControllerAndBasebandOpCode(0x0023);
319 
320 // =============================================
321 // Write Class Of Device Command (v1.1) (BR/EDR)
322 inline constexpr OpCode kWriteClassOfDevice =
323     ControllerAndBasebandOpCode(0x0024);
324 
325 // =============================================
326 // Write Automatic Flush Timeout Command (v1.1) (BR/EDR)
327 inline constexpr OpCode kWriteAutomaticFlushTimeout =
328     ControllerAndBasebandOpCode(0x0028);
329 
330 // ===============================================================
331 // Read Transmit Transmit Power Level Command (v1.1) (BR/EDR & LE)
332 inline constexpr OpCode kReadTransmitPowerLevel =
333     ControllerAndBasebandOpCode(0x002D);
334 
335 // ===============================================================
336 // Write Synchonous Flow Control Enable Command (BR/EDR)
337 inline constexpr OpCode kWriteSynchronousFlowControlEnable =
338     ControllerAndBasebandOpCode(0x002F);
339 
340 // ===================================
341 // Read Inquiry Scan Type (v1.2) (BR/EDR)
342 inline constexpr OpCode kReadInquiryScanType =
343     ControllerAndBasebandOpCode(0x0042);
344 
345 // ====================================
346 // Write Inquiry Scan Type (v1.2) (BR/EDR)
347 inline constexpr OpCode kWriteInquiryScanType =
348     ControllerAndBasebandOpCode(0x0043);
349 
350 // =================================
351 // Read Inquiry Mode (v1.2) (BR/EDR)
352 inline constexpr OpCode kReadInquiryMode = ControllerAndBasebandOpCode(0x0044);
353 
354 // ==================================
355 // Write Inquiry Mode (v1.2) (BR/EDR)
356 inline constexpr OpCode kWriteInquiryMode = ControllerAndBasebandOpCode(0x0045);
357 
358 // ===================================
359 // Read Page Scan Type (v1.2) (BR/EDR)
360 inline constexpr OpCode kReadPageScanType = ControllerAndBasebandOpCode(0x0046);
361 
362 // ====================================
363 // Write Page Scan Type (v1.2) (BR/EDR)
364 inline constexpr OpCode kWritePageScanType =
365     ControllerAndBasebandOpCode(0x0047);
366 
367 // =================================
368 // Write Extended Inquiry Response (v1.2) (BR/EDR)
369 inline constexpr OpCode kWriteExtendedInquiryResponse =
370     ControllerAndBasebandOpCode(0x0052);
371 
372 // ==============================================
373 // Read Simple Pairing Mode (v2.1 + EDR) (BR/EDR)
374 inline constexpr OpCode kReadSimplePairingMode =
375     ControllerAndBasebandOpCode(0x0055);
376 
377 // ===============================================
378 // Write Simple Pairing Mode (v2.1 + EDR) (BR/EDR)
379 inline constexpr OpCode kWriteSimplePairingMode =
380     ControllerAndBasebandOpCode(0x0056);
381 
382 // =========================================
383 // Set Event Mask Page 2 Command (v3.0 + HS)
384 inline constexpr OpCode kSetEventMaskPage2 =
385     ControllerAndBasebandOpCode(0x0063);
386 
387 // =========================================================
388 // Read Flow Control Mode Command (v3.0 + HS) (BR/EDR & AMP)
389 inline constexpr OpCode kReadFlowControlMode =
390     ControllerAndBasebandOpCode(0x0066);
391 
392 // ==========================================================
393 // Write Flow Control Mode Command (v3.0 + HS) (BR/EDR & AMP)
394 inline constexpr OpCode kWriteFlowControlMode =
395     ControllerAndBasebandOpCode(0x0067);
396 
397 // ============================================
398 // Read LE Host Support Command (v4.0) (BR/EDR)
399 inline constexpr OpCode kReadLEHostSupport =
400     ControllerAndBasebandOpCode(0x006C);
401 
402 // =============================================
403 // Write LE Host Support Command (v4.0) (BR/EDR)
404 inline constexpr OpCode kWriteLEHostSupport =
405     ControllerAndBasebandOpCode(0x006D);
406 
407 // =============================================
408 // Write Secure Connections Host Support Command (v4.1) (BR/EDR)
409 inline constexpr OpCode kWriteSecureConnectionsHostSupport =
410     ControllerAndBasebandOpCode(0x007A);
411 
412 // ===============================================================
413 // Read Authenticated Payload Timeout Command (v4.1) (BR/EDR & LE)
414 inline constexpr OpCode kReadAuthenticatedPayloadTimeout =
415     ControllerAndBasebandOpCode(0x007B);
416 
417 // ================================================================
418 // Write Authenticated Payload Timeout Command (v4.1) (BR/EDR & LE)
419 inline constexpr OpCode kWriteAuthenticatedPayloadTimeout =
420     ControllerAndBasebandOpCode(0x007C);
421 
422 // ======= Informational Parameters =======
423 // Core Spec v5.0 Vol 2, Part E, Section 7.4
424 inline constexpr uint8_t kInformationalParamsOGF = 0x04;
InformationalParamsOpCode(const uint16_t ocf)425 constexpr OpCode InformationalParamsOpCode(const uint16_t ocf) {
426   return DefineOpCode(kInformationalParamsOGF, ocf);
427 }
428 
429 // =============================================
430 // Read Local Version Information Command (v1.1)
431 inline constexpr OpCode kReadLocalVersionInfo =
432     InformationalParamsOpCode(0x0001);
433 
434 // ============================================
435 // Read Local Supported Commands Command (v1.2)
436 inline constexpr OpCode kReadLocalSupportedCommands =
437     InformationalParamsOpCode(0x0002);
438 
439 // ============================================
440 // Read Local Supported Features Command (v1.1)
441 inline constexpr OpCode kReadLocalSupportedFeatures =
442     InformationalParamsOpCode(0x0003);
443 
444 // ====================================================
445 // Read Local Extended Features Command (v1.2) (BR/EDR)
446 inline constexpr OpCode kReadLocalExtendedFeatures =
447     InformationalParamsOpCode(0x0004);
448 
449 // ===============================
450 // Read Buffer Size Command (v1.1)
451 inline constexpr OpCode kReadBufferSize = InformationalParamsOpCode(0x0005);
452 
453 // ========================================
454 // Read BD_ADDR Command (v1.1) (BR/EDR, LE)
455 inline constexpr OpCode kReadBDADDR = InformationalParamsOpCode(0x0009);
456 
457 // =======================================================
458 // Read Data Block Size Command (v3.0 + HS) (BR/EDR & AMP)
459 inline constexpr OpCode kReadDataBlockSize = InformationalParamsOpCode(0x000A);
460 
461 // ====================================================
462 // Read Local Supported Controller Delay Command (v5.2)
463 inline constexpr OpCode kReadLocalSupportedControllerDelay =
464     InformationalParamsOpCode(0x000F);
465 
466 // ======= Events =======
467 // Core Spec v5.0 Vol 2, Part E, Section 7.7
468 
469 // Reserved for vendor-specific debug events
470 // (Vol 2, Part E, Section 5.4.4)
471 inline constexpr EventCode kVendorDebugEventCode = 0xFF;
472 
473 // ======================================
474 // Inquiry Complete Event (v1.1) (BR/EDR)
475 inline constexpr EventCode kInquiryCompleteEventCode = 0x01;
476 
477 // ====================================
478 // Inquiry Result Event (v1.1) (BR/EDR)
479 inline constexpr EventCode kInquiryResultEventCode = 0x02;
480 
481 // =========================================
482 // Connection Complete Event (v1.1) (BR/EDR)
483 inline constexpr EventCode kConnectionCompleteEventCode = 0x03;
484 
485 // ========================================
486 // Connection Request Event (v1.1) (BR/EDR)
487 inline constexpr EventCode kConnectionRequestEventCode = 0x04;
488 
489 // =================================================
490 // Disconnection Complete Event (v1.1) (BR/EDR & LE)
491 inline constexpr EventCode kDisconnectionCompleteEventCode = 0x05;
492 
493 // =============================================
494 // Authentication Complete Event (v1.1) (BR/EDR)
495 inline constexpr EventCode kAuthenticationCompleteEventCode = 0x06;
496 
497 // ==================================================
498 // Remote Name Request Complete Event (v1.1) (BR/EDR)
499 inline constexpr EventCode kRemoteNameRequestCompleteEventCode = 0x07;
500 
501 // ============================================
502 // Encryption Change Event (v1.1) (BR/EDR & LE)
503 inline constexpr EventCode kEncryptionChangeEventCode = 0x08;
504 
505 // =========================================================
506 // Change Connection Link Key Complete Event (v1.1) (BR/EDR)
507 inline constexpr EventCode kChangeConnectionLinkKeyCompleteEventCode = 0x09;
508 
509 // =============================================================
510 // Read Remote Supported Features Complete Event (v1.1) (BR/EDR)
511 inline constexpr EventCode kReadRemoteSupportedFeaturesCompleteEventCode = 0x0B;
512 
513 // ===================================================================
514 // Read Remote Version Information Complete Event (v1.1) (BR/EDR & LE)
515 inline constexpr EventCode kReadRemoteVersionInfoCompleteEventCode = 0x0C;
516 
517 // =============================
518 // Command Complete Event (v1.1)
519 inline constexpr EventCode kCommandCompleteEventCode = 0x0E;
520 
521 // ===========================
522 // Command Status Event (v1.1)
523 inline constexpr EventCode kCommandStatusEventCode = 0x0F;
524 inline constexpr uint8_t kCommandStatusPending = 0x00;
525 
526 // ===========================
527 // Hardware Error Event (v1.1)
528 inline constexpr EventCode kHardwareErrorEventCode = 0x10;
529 
530 // ========================================
531 // Role Change Event (BR/EDR) (v1.1)
532 inline constexpr EventCode kRoleChangeEventCode = 0x12;
533 
534 // ========================================
535 // Number Of Completed Packets Event (v1.1)
536 inline constexpr EventCode kNumberOfCompletedPacketsEventCode = 0x13;
537 
538 // ======================================
539 // PIN Code Request Event (v1.1) (BR/EDR)
540 inline constexpr EventCode kPinCodeRequestEventCode = 0x16;
541 
542 // ======================================
543 // Link Key Request Event (v1.1) (BR/EDR)
544 inline constexpr EventCode kLinkKeyRequestEventCode = 0x17;
545 
546 // ===========================================
547 // Link Key Notification Event (v1.1) (BR/EDR)
548 inline constexpr EventCode kLinkKeyNotificationEventCode = 0x18;
549 
550 // ===========================================
551 // Data Buffer Overflow Event (v1.1) (BR/EDR & LE)
552 inline constexpr EventCode kDataBufferOverflowEventCode = 0x1A;
553 
554 // ==============================================
555 // Inquiry Result with RSSI Event (v1.2) (BR/EDR)
556 inline constexpr EventCode kInquiryResultWithRSSIEventCode = 0x22;
557 
558 // ============================================================
559 // Read Remote Extended Features Complete Event (v1.1) (BR/EDR)
560 inline constexpr EventCode kReadRemoteExtendedFeaturesCompleteEventCode = 0x23;
561 
562 // ============================================================
563 // Synchronous Connection Complete Event (BR/EDR)
564 inline constexpr EventCode kSynchronousConnectionCompleteEventCode = 0x2C;
565 
566 // =============================================
567 // Extended Inquiry Result Event (v1.2) (BR/EDR)
568 inline constexpr EventCode kExtendedInquiryResultEventCode = 0x2F;
569 
570 // ================================================================
571 // Encryption Key Refresh Complete Event (v2.1 + EDR) (BR/EDR & LE)
572 inline constexpr EventCode kEncryptionKeyRefreshCompleteEventCode = 0x30;
573 
574 // =================================================
575 // IO Capability Request Event (v2.1 + EDR) (BR/EDR)
576 inline constexpr EventCode kIOCapabilityRequestEventCode = 0x31;
577 
578 // ==================================================
579 // IO Capability Response Event (v2.1 + EDR) (BR/EDR)
580 inline constexpr EventCode kIOCapabilityResponseEventCode = 0x32;
581 
582 // =====================================================
583 // User Confirmation Request Event (v2.1 + EDR) (BR/EDR)
584 inline constexpr EventCode kUserConfirmationRequestEventCode = 0x33;
585 
586 // ================================================
587 // User Passkey Request Event (v2.1 + EDR) (BR/EDR)
588 inline constexpr EventCode kUserPasskeyRequestEventCode = 0x34;
589 
590 // ===================================================
591 // Simple Pairing Complete Event (v2.1 + EDR) (BR/EDR)
592 inline constexpr EventCode kSimplePairingCompleteEventCode = 0x36;
593 
594 // =====================================================
595 // User Passkey Notification Event (v2.1 + EDR) (BR/EDR)
596 inline constexpr EventCode kUserPasskeyNotificationEventCode = 0x3B;
597 
598 // =========================
599 // LE Meta Event (v4.0) (LE)
600 inline constexpr EventCode kLEMetaEventCode = 0x3E;
601 
602 // LE Connection Complete Event (v4.0) (LE)
603 inline constexpr EventCode kLEConnectionCompleteSubeventCode = 0x01;
604 
605 // LE Advertising Report Event (v4.0) (LE)
606 inline constexpr EventCode kLEAdvertisingReportSubeventCode = 0x02;
607 
608 // LE Connection Update Complete Event (v4.0) (LE)
609 inline constexpr EventCode kLEConnectionUpdateCompleteSubeventCode = 0x03;
610 
611 // LE Read Remote Features Complete Event (v4.0) (LE)
612 inline constexpr EventCode kLEReadRemoteFeaturesCompleteSubeventCode = 0x04;
613 
614 // LE Long Term Key Request Event (v4.0) (LE)
615 inline constexpr EventCode kLELongTermKeyRequestSubeventCode = 0x05;
616 
617 // LE Remote Connection Parameter Request Event (v4.1) (LE)
618 inline constexpr EventCode kLERemoteConnectionParameterRequestSubeventCode =
619     0x06;
620 
621 // LE Data Length Change Event (v4.2) (LE)
622 inline constexpr EventCode kLEDataLengthChangeSubeventCode = 0x07;
623 
624 // LE Read Local P-256 Public Key Complete Event (v4.2) (LE)
625 inline constexpr EventCode kLEReadLocalP256PublicKeyCompleteSubeventCode = 0x08;
626 
627 // LE Generate DHKey Complete Event (v4.2) (LE)
628 inline constexpr EventCode kLEGenerateDHKeyCompleteSubeventCode = 0x09;
629 
630 // LE Enhanced Connection Complete Event (v4.2) (LE)
631 inline constexpr EventCode kLEEnhancedConnectionCompleteSubeventCode = 0x0A;
632 
633 // LE Directed Advertising Report Event (v4.2) (LE)
634 inline constexpr EventCode kLEDirectedAdvertisingReportSubeventCode = 0x0B;
635 
636 // LE PHY Update Complete Event (v5.0) (LE)
637 inline constexpr EventCode kLEPHYUpdateCompleteSubeventCode = 0x0C;
638 
639 // LE Extended Advertising Report Event (v5.0) (LE)
640 inline constexpr EventCode kLEExtendedAdvertisingReportSubeventCode = 0x0D;
641 
642 // LE Periodic Advertising Sync Established Event (v5.0) (LE)
643 inline constexpr EventCode kLEPeriodicAdvertisingSyncEstablishedSubeventCode =
644     0x0E;
645 
646 // LE Periodic Advertising Report Event (v5.0) (LE)
647 inline constexpr EventCode kLEPeriodicAdvertisingReportSubeventCode = 0x0F;
648 
649 // LE Periodic Advertising Sync Lost Event (v5.0) (LE)
650 inline constexpr EventCode kLEPeriodicAdvertisingSyncLostSubeventCode = 0x10;
651 
652 // LE Scan Timeout Event (v5.0) (LE)
653 inline constexpr EventCode kLEScanTimeoutSubeventCode = 0x11;
654 
655 // LE Advertising Set Terminated Event (v5.0) (LE)
656 inline constexpr EventCode kLEAdvertisingSetTerminatedSubeventCode = 0x012;
657 
658 // LE Scan Request Received Event (v5.0) (LE)
659 inline constexpr EventCode kLEScanRequestReceivedSubeventCode = 0x13;
660 
661 // LE Channel Selection Algorithm Event (v5.0) (LE)
662 inline constexpr EventCode kLEChannelSelectionAlgorithmSubeventCode = 0x014;
663 
664 // LE Request Peer SCA Complete Event (v5.2) (LE)
665 inline constexpr EventCode kLERequestPeerSCACompleteSubeventCode = 0x1F;
666 
667 // LE CIS Established Event (v5.2) (LE)
668 inline constexpr EventCode kLECISEstablishedSubeventCode = 0x019;
669 
670 // LE CIS Request Event (v5.2) (LE)
671 inline constexpr EventCode kLECISRequestSubeventCode = 0x01A;
672 
673 // ================================================================
674 // Number Of Completed Data Blocks Event (v3.0 + HS) (BR/EDR & AMP)
675 inline constexpr EventCode kNumberOfCompletedDataBlocksEventCode = 0x48;
676 
677 // ================================================================
678 // Authenticated Payload Timeout Expired Event (v4.1) (BR/EDR & LE)
679 inline constexpr EventCode kAuthenticatedPayloadTimeoutExpiredEventCode = 0x57;
680 
681 // ======= Status Parameters =======
682 // Core Spec v5.0, Vol 2, Part E, Section 7.5
683 inline constexpr uint8_t kStatusParamsOGF = 0x05;
StatusParamsOpCode(const uint16_t ocf)684 constexpr OpCode StatusParamsOpCode(const uint16_t ocf) {
685   return DefineOpCode(kStatusParamsOGF, ocf);
686 }
687 
688 // ========================
689 // Read RSSI Command (v1.1)
690 inline constexpr OpCode kReadRSSI = StatusParamsOpCode(0x0005);
691 
692 // ========================================
693 // Read Encryption Key Size (v1.1) (BR/EDR)
694 inline constexpr OpCode kReadEncryptionKeySize = StatusParamsOpCode(0x0008);
695 
696 // ======= LE Controller Commands =======
697 // Core Spec v5.0 Vol 2, Part E, Section 7.8
698 inline constexpr uint8_t kLEControllerCommandsOGF = 0x08;
LEControllerCommandOpCode(const uint16_t ocf)699 constexpr OpCode LEControllerCommandOpCode(const uint16_t ocf) {
700   return DefineOpCode(kLEControllerCommandsOGF, ocf);
701 }
702 
703 // Returns true if the given |opcode| corresponds to a LE controller command.
IsLECommand(OpCode opcode)704 inline bool IsLECommand(OpCode opcode) {
705   return GetOGF(opcode) == kLEControllerCommandsOGF;
706 }
707 
708 // =====================================
709 // LE Set Event Mask Command (v4.0) (LE)
710 inline constexpr OpCode kLESetEventMask = LEControllerCommandOpCode(0x0001);
711 
712 // =======================================
713 // LE Read Buffer Size [v1] Command (v4.0) (LE)
714 inline constexpr OpCode kLEReadBufferSizeV1 = LEControllerCommandOpCode(0x0002);
715 
716 // ====================================================
717 // LE Read Local Supported Features Command (v4.0) (LE)
718 inline constexpr OpCode kLEReadLocalSupportedFeatures =
719     LEControllerCommandOpCode(0x0003);
720 
721 // =========================================
722 // LE Set Random Address Command (v4.0) (LE)
723 inline constexpr OpCode kLESetRandomAddress = LEControllerCommandOpCode(0x0005);
724 
725 // =================================================
726 // LE Set Advertising Parameters Command (v4.0) (LE)
727 inline constexpr OpCode kLESetAdvertisingParameters =
728     LEControllerCommandOpCode(0x0006);
729 
730 // ========================================================
731 // LE Read Advertising Channel Tx Power Command (v4.0) (LE)
732 inline constexpr OpCode kLEReadAdvertisingChannelTxPower =
733     LEControllerCommandOpCode(0x0007);
734 
735 // ===========================================
736 // LE Set Advertising Data Command (v4.0) (LE)
737 inline constexpr OpCode kLESetAdvertisingData =
738     LEControllerCommandOpCode(0x0008);
739 
740 // =============================================
741 // LE Set Scan Response Data Command (v4.0) (LE)
742 inline constexpr OpCode kLESetScanResponseData =
743     LEControllerCommandOpCode(0x0009);
744 
745 // =============================================
746 // LE Set Advertising Enable Command (v4.0) (LE)
747 inline constexpr OpCode kLESetAdvertisingEnable =
748     LEControllerCommandOpCode(0x000A);
749 
750 // ==========================================
751 // LE Set Scan Parameters Command (v4.0) (LE)
752 inline constexpr OpCode kLESetScanParameters =
753     LEControllerCommandOpCode(0x000B);
754 
755 // ======================================
756 // LE Set Scan Enable Command (v4.0) (LE)
757 inline constexpr OpCode kLESetScanEnable = LEControllerCommandOpCode(0x000C);
758 
759 // ========================================
760 // LE Create Connection Command (v4.0) (LE)
761 inline constexpr OpCode kLECreateConnection = LEControllerCommandOpCode(0x000D);
762 
763 // ===============================================
764 // LE Create Connection Cancel Command (v4.0) (LE)
765 inline constexpr OpCode kLECreateConnectionCancel =
766     LEControllerCommandOpCode(0x000E);
767 
768 // ===========================================
769 // LE Read Filter Accept List Size Command (v4.0) (LE)
770 inline constexpr OpCode kLEReadFilterAcceptListSize =
771     LEControllerCommandOpCode(0x000F);
772 
773 // =======================================
774 // LE Clear Filter Accept List Command (v4.0) (LE)
775 inline constexpr OpCode kLEClearFilterAcceptList =
776     LEControllerCommandOpCode(0x0010);
777 
778 // ===============================================
779 // LE Add Device To Filter Accept List Command (v4.0) (LE)
780 inline constexpr OpCode kLEAddDeviceToFilterAcceptList =
781     LEControllerCommandOpCode(0x0011);
782 
783 // ====================================================
784 // LE Remove Device From Filter Accept List Command (v4.0) (LE)
785 inline constexpr OpCode kLERemoveDeviceFromFilterAcceptList =
786     LEControllerCommandOpCode(0x0012);
787 
788 // ========================================
789 // LE Connection Update Command (v4.0) (LE)
790 inline constexpr OpCode kLEConnectionUpdate = LEControllerCommandOpCode(0x0013);
791 
792 // ======================================================
793 // LE Set Host Channel Classification Command (v4.0) (LE)
794 inline constexpr OpCode kLESetHostChannelClassification =
795     LEControllerCommandOpCode(0x0014);
796 
797 // =======================================
798 // LE Read Channel Map Command (v4.0) (LE)
799 inline constexpr OpCode kLEReadChannelMap = LEControllerCommandOpCode(0x0015);
800 
801 // ===========================================
802 // LE Read Remote Features Command (v4.0) (LE)
803 inline constexpr OpCode kLEReadRemoteFeatures =
804     LEControllerCommandOpCode(0x0016);
805 
806 // ==============================
807 // LE Encrypt Command (v4.0) (LE)
808 inline constexpr OpCode kLEEncrypt = LEControllerCommandOpCode(0x0017);
809 
810 // ===========================
811 // LE Rand Command (v4.0) (LE)
812 inline constexpr OpCode kLERand = LEControllerCommandOpCode(0x0018);
813 
814 // =======================================
815 // LE Start Encryption Command (v4.0) (LE)
816 inline constexpr OpCode kLEStartEncryption = LEControllerCommandOpCode(0x0019);
817 
818 // ==================================================
819 // LE Long Term Key Request Reply Command (v4.0) (LE)
820 inline constexpr OpCode kLELongTermKeyRequestReply =
821     LEControllerCommandOpCode(0x001A);
822 
823 // ===========================================================
824 // LE Long Term Key Request Negative Reply Command (v4.0) (LE)
825 inline constexpr OpCode kLELongTermKeyRequestNegativeReply =
826     LEControllerCommandOpCode(0x001B);
827 
828 // ============================================
829 // LE Read Supported States Command (v4.0) (LE)
830 inline constexpr OpCode kLEReadSupportedStates =
831     LEControllerCommandOpCode(0x001C);
832 
833 // ====================================
834 // LE Receiver Test Command (v4.0) (LE)
835 inline constexpr OpCode kLEReceiverTest = LEControllerCommandOpCode(0x001D);
836 
837 // ======================================
838 // LE Transmitter Test Command (v4.0) (LE)
839 inline constexpr OpCode kLETransmitterTest = LEControllerCommandOpCode(0x001E);
840 
841 // ===============================
842 // LE Test End Command (v4.0) (LE)
843 inline constexpr OpCode kLETestEnd = LEControllerCommandOpCode(0x001F);
844 
845 // ================================================================
846 // LE Remote Connection Parameter Request Reply Command (v4.1) (LE)
847 inline constexpr OpCode kLERemoteConnectionParameterRequestReply =
848     LEControllerCommandOpCode(0x0020);
849 
850 // =========================================================================
851 // LE Remote Connection Parameter Request Negative Reply Command (v4.1) (LE)
852 inline constexpr OpCode kLERemoteConnectionParameterRequestNegativeReply =
853     LEControllerCommandOpCode(0x0021);
854 
855 // ======================================
856 // LE Set Data Length Command (v4.2) (LE)
857 inline constexpr OpCode kLESetDataLength = LEControllerCommandOpCode(0x0022);
858 
859 // =========================================================
860 // LE Read Suggested Default Data Length Command (v4.2) (LE)
861 inline constexpr OpCode kLEReadSuggestedDefaultDataLength =
862     LEControllerCommandOpCode(0x0023);
863 
864 // ==========================================================
865 // LE Write Suggested Default Data Length Command (v4.2) (LE)
866 inline constexpr OpCode kLEWriteSuggestedDefaultDataLength =
867     LEControllerCommandOpCode(0x0024);
868 
869 // ==================================================
870 // LE Read Local P-256 Public Key Command (v4.2) (LE)
871 inline constexpr OpCode kLEReadLocalP256PublicKey =
872     LEControllerCommandOpCode(0x0025);
873 
874 // ======================================
875 // LE Generate DH Key Command (v4.2) (LE)
876 inline constexpr OpCode kLEGenerateDHKey = LEControllerCommandOpCode(0x0026);
877 
878 // ===================================================
879 // LE Add Device To Resolving List Command (v4.2) (LE)
880 inline constexpr OpCode kLEAddDeviceToResolvingList =
881     LEControllerCommandOpCode(0x0027);
882 
883 // ========================================================
884 // LE Remove Device From Resolving List Command (v4.2) (LE)
885 inline constexpr OpCode kLERemoveDeviceFromResolvingList =
886     LEControllerCommandOpCode(0x0028);
887 
888 // ===========================================
889 // LE Clear Resolving List Command (v4.2) (LE)
890 inline constexpr OpCode kLEClearResolvingList =
891     LEControllerCommandOpCode(0x0029);
892 
893 // ===============================================
894 // LE Read Resolving List Size Command (v4.2) (LE)
895 inline constexpr OpCode kLEReadResolvingListSize =
896     LEControllerCommandOpCode(0x002A);
897 
898 // ===================================================
899 // LE Read Peer Resolvable Address Command (v4.2) (LE)
900 inline constexpr OpCode kLEReadPeerResolvableAddress =
901     LEControllerCommandOpCode(0x002B);
902 
903 // ====================================================
904 // LE Read Local Resolvable Address Command (v4.2) (LE)
905 inline constexpr OpCode kLEReadLocalResolvableAddress =
906     LEControllerCommandOpCode(0x002C);
907 
908 // ====================================================
909 // LE Set Address Resolution Enable Command (v4.2) (LE)
910 inline constexpr OpCode kLESetAddressResolutionEnable =
911     LEControllerCommandOpCode(0x002D);
912 
913 // =============================================================
914 // LE Set Resolvable Private Address Timeout Command (v4.2) (LE)
915 inline constexpr OpCode kLESetResolvablePrivateAddressTimeout =
916     LEControllerCommandOpCode(0x002E);
917 
918 // ===============================================
919 // LE Read Maximum Data Length Command (v4.2) (LE)
920 inline constexpr OpCode kLEReadMaximumDataLength =
921     LEControllerCommandOpCode(0x002F);
922 
923 // ===============================
924 // LE Read PHY Command (v5.0) (LE)
925 inline constexpr OpCode kLEReadPHY = LEControllerCommandOpCode(0x0030);
926 
927 // ======================================
928 // LE Set Default PHY Command (v5.0) (LE)
929 inline constexpr OpCode kLESetDefaultPHY = LEControllerCommandOpCode(0x0031);
930 
931 // ==============================
932 // LE Set PHY Command (v5.0) (LE)
933 inline constexpr OpCode kLESetPHY = LEControllerCommandOpCode(0x0032);
934 
935 // =============================================
936 // LE Enhanced Receiver Test Command (v5.0) (LE)
937 inline constexpr OpCode kLEEnhancedReceiverText =
938     LEControllerCommandOpCode(0x0033);
939 
940 // ================================================
941 // LE Enhanced Transmitter Test Command (v5.0) (LE)
942 inline constexpr OpCode kLEEnhancedTransmitterTest =
943     LEControllerCommandOpCode(0x0034);
944 
945 // =========================================================
946 // LE Set Advertising Set Random Address Command (v5.0) (LE)
947 inline constexpr OpCode kLESetAdvertisingSetRandomAddress =
948     LEControllerCommandOpCode(0x0035);
949 
950 // ==========================================================
951 // LE Set Extended Advertising Parameters Command (v5.0) (LE)
952 inline constexpr OpCode kLESetExtendedAdvertisingParameters =
953     LEControllerCommandOpCode(0x0036);
954 
955 // ====================================================
956 // LE Set Extended Advertising Data Command (v5.0) (LE)
957 inline constexpr OpCode kLESetExtendedAdvertisingData =
958     LEControllerCommandOpCode(0x0037);
959 
960 // ======================================================
961 // LE Set Extended Scan Response Data Command (v5.0) (LE)
962 inline constexpr OpCode kLESetExtendedScanResponseData =
963     LEControllerCommandOpCode(0x0038);
964 
965 // ======================================================
966 // LE Set Extended Advertising Enable Command (v5.0) (LE)
967 inline constexpr OpCode kLESetExtendedAdvertisingEnable =
968     LEControllerCommandOpCode(0x0039);
969 
970 // ===========================================================
971 // LE Read Maximum Advertising Data Length Command (v5.0) (LE)
972 inline constexpr OpCode kLEReadMaximumAdvertisingDataLength =
973     LEControllerCommandOpCode(0x003A);
974 
975 // ================================================================
976 // LE Read Number of Supported Advertising Sets Command (v5.0) (LE)
977 inline constexpr OpCode kLEReadNumSupportedAdvertisingSets =
978     LEControllerCommandOpCode(0x003B);
979 
980 // =============================================
981 // LE Remove Advertising Set Command (v5.0) (LE)
982 inline constexpr OpCode kLERemoveAdvertisingSet =
983     LEControllerCommandOpCode(0x003C);
984 
985 // =============================================
986 // LE Clear Advertising Sets Command (v5.0) (LE)
987 inline constexpr OpCode kLEClearAdvertisingSets =
988     LEControllerCommandOpCode(0x003D);
989 
990 // ==========================================================
991 // LE Set Periodic Advertising Parameters Command (v5.0) (LE)
992 inline constexpr OpCode kLESetPeriodicAdvertisingParameters =
993     LEControllerCommandOpCode(0x003E);
994 
995 // ====================================================
996 // LE Set Periodic Advertising Data Command (v5.0) (LE)
997 inline constexpr OpCode kLESetPeriodicAdvertisingData =
998     LEControllerCommandOpCode(0x003F);
999 
1000 // ======================================================
1001 // LE Set Periodic Advertising Enable Command (v5.0) (LE)
1002 inline constexpr OpCode kLESetPeriodicAdvertisingEnable =
1003     LEControllerCommandOpCode(0x0040);
1004 
1005 // ===================================================
1006 // LE Set Extended Scan Parameters Command (v5.0) (LE)
1007 inline constexpr OpCode kLESetExtendedScanParameters =
1008     LEControllerCommandOpCode(0x0041);
1009 
1010 // ===============================================
1011 // LE Set Extended Scan Enable Command (v5.0) (LE)
1012 inline constexpr OpCode kLESetExtendedScanEnable =
1013     LEControllerCommandOpCode(0x0042);
1014 
1015 // =================================================
1016 // LE Extended Create Connection Command (v5.0) (LE)
1017 inline constexpr OpCode kLEExtendedCreateConnection =
1018     LEControllerCommandOpCode(0x0043);
1019 
1020 // =======================================================
1021 // LE Periodic Advertising Create Sync Command (v5.0) (LE)
1022 inline constexpr OpCode kLEPeriodicAdvertisingCreateSync =
1023     LEControllerCommandOpCode(0x0044);
1024 
1025 // ==============================================================
1026 // LE Periodic Advertising Create Sync Cancel Command (v5.0) (LE)
1027 inline constexpr OpCode kLEPeriodicAdvertisingCreateSyncCancel =
1028     LEControllerCommandOpCode(0x0045);
1029 
1030 // ==========================================================
1031 // LE Periodic Advertising Terminate Sync Command (v5.0) (LE)
1032 inline constexpr OpCode kLEPeriodicAdvertisingTerminateSync =
1033     LEControllerCommandOpCode(0x0046);
1034 
1035 // =============================================================
1036 // LE Add Device To Periodic Advertiser List Command (v5.0) (LE)
1037 inline constexpr OpCode kLEAddDeviceToPeriodicAdvertiserList =
1038     LEControllerCommandOpCode(0x0047);
1039 
1040 // ==================================================================
1041 // LE Remove Device From Periodic Advertiser List Command (v5.0) (LE)
1042 inline constexpr OpCode kLERemoveDeviceFromPeriodicAdvertiserList =
1043     LEControllerCommandOpCode(0x0048);
1044 
1045 // =====================================================
1046 // LE Clear Periodic Advertiser List Command (v5.0) (LE)
1047 inline constexpr OpCode kLEClearPeriodicAdvertiserList =
1048     LEControllerCommandOpCode(0x0049);
1049 
1050 // =========================================================
1051 // LE Read Periodic Advertiser List Size Command (v5.0) (LE)
1052 inline constexpr OpCode kLEReadPeriodicAdvertiserListSize =
1053     LEControllerCommandOpCode(0x004A);
1054 
1055 // ==========================================
1056 // LE Read Transmit Power Command (v5.0) (LE)
1057 inline constexpr OpCode kLEReadTransmitPower =
1058     LEControllerCommandOpCode(0x004B);
1059 
1060 // ================================================
1061 // LE Read RF Path Compensation Command (v5.0) (LE)
1062 inline constexpr OpCode kLEReadRFPathCompensation =
1063     LEControllerCommandOpCode(0x004C);
1064 
1065 // =================================================
1066 // LE Write RF Path Compensation Command (v5.0) (LE)
1067 inline constexpr OpCode kLEWriteRFPathCompensation =
1068     LEControllerCommandOpCode(0x004D);
1069 
1070 // =======================================
1071 // LE Set Privacy Mode Command (v5.0) (LE)
1072 inline constexpr OpCode kLESetPrivacyMode = LEControllerCommandOpCode(0x004E);
1073 
1074 // ============================================
1075 // LE Read Buffer Size [v2] Command (v5.2) (LE)
1076 inline constexpr OpCode kLEReadBufferSizeV2 = LEControllerCommandOpCode(0x0060);
1077 
1078 // =======================================
1079 // LE Request Peer SCA Command (v5.2) (LE)
1080 inline constexpr OpCode kLERequestPeerSCA = LEControllerCommandOpCode(0x006D);
1081 
1082 // ==========================================
1083 // LE Setup ISO Data Path Command (v5.2) (LE)
1084 inline constexpr OpCode kLESetupISODataPath = LEControllerCommandOpCode(0x006E);
1085 
1086 // =======================================
1087 // LE Set Host Feature Command (v5.2) (LE)
1088 inline constexpr OpCode kLESetHostFeature = LEControllerCommandOpCode(0x0074);
1089 
1090 // =========================================
1091 // LE Accept CIS Request Command (v5.2) (LE)
1092 inline constexpr OpCode kLEAcceptCISRequest = LEControllerCommandOpCode(0x0066);
1093 
1094 // =========================================
1095 // LE Reject CIS Request Command (v5.2) (LE)
1096 inline constexpr OpCode kLERejectCISRequest = LEControllerCommandOpCode(0x0067);
1097 
1098 // ======= Vendor Command =======
1099 // Core Spec v5.0, Vol 2, Part E, Section 5.4.1
1100 inline constexpr uint8_t kVendorOGF = 0x3F;
VendorOpCode(const uint16_t ocf)1101 constexpr OpCode VendorOpCode(const uint16_t ocf) {
1102   return DefineOpCode(kVendorOGF, ocf);
1103 }
1104 
1105 }  // namespace bt::hci_spec
1106