1  /*
2   * Copyright (C) 2021 Huawei Device Co., Ltd.
3   * Licensed under the Apache License, Version 2.0 (the "License");
4   * you may not use this file except in compliance with the License.
5   * You may obtain a copy of the License at
6   *
7   *     http://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,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  
16  #ifndef HCI_DEF_LINK_CTRL_CMD_H
17  #define HCI_DEF_LINK_CTRL_CMD_H
18  
19  #include <stdint.h>
20  
21  #include "hci_def_cmd_common.h"
22  
23  #ifdef __cplusplus
24  extern "C" {
25  #endif
26  
27  #pragma pack(1)
28  
29  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
30  // 7.1 LINK CONTROL COMMANDS
31  #define HCI_COMMAND_OGF_LINK_CONTROL 0x01
32  
33  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
34  // 7.1.1 Inquiry Command
35  #define HCI_INQUIRY MAKE_OPCODE(0x0001, HCI_COMMAND_OGF_LINK_CONTROL)
36  
37  typedef struct {
38      uint32_t lap : 24;
39      uint8_t inquiryLen;
40      uint8_t numResponses;
41  } HciInquiryeParam;
42  
43  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
44  // 7.1.2 Inquiry Cancel Command
45  #define HCI_INQUIRY_CANCEL MAKE_OPCODE(0x0002, HCI_COMMAND_OGF_LINK_CONTROL)
46  
47  typedef HciStatusParam HciInquiryCancelReturnParam;
48  
49  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
50  // 7.1.3 Periodic Inquiry Mode Command
51  #define HCI_PERIODIC_INQUIRY_MODE MAKE_OPCODE(0x0003, HCI_COMMAND_OGF_LINK_CONTROL)
52  
53  typedef struct {
54      uint16_t maxPeriodLength;
55      uint16_t minPeriodLength;
56      uint32_t lap : 24;
57      uint8_t inquiryLength;
58      uint8_t numResponses;
59  } HciPeriodicInquiryModeParam;
60  
61  typedef HciStatusParam HciPeriodicInquiryModeReturnParam;
62  
63  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
64  // 7.1.4 Exit Periodic Inquiry Mode Command
65  #define HCI_EXIT_PERIODIC_INQUIRY_MODE MAKE_OPCODE(0x0004, HCI_COMMAND_OGF_LINK_CONTROL)
66  
67  typedef HciStatusParam HciExitPeriodicInquiryModeReturnParam;
68  
69  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
70  // 7.1.5 Create Connection Command
71  #define HCI_CREATE_CONNECTION MAKE_OPCODE(0x0005, HCI_COMMAND_OGF_LINK_CONTROL)
72  
73  #define HCI_PACKET_TYPE_NO_2_DH1 0x0002
74  #define HCI_PACKET_TYPE_NO_3_DH1 0x0004
75  #define HCI_PACKET_TYPE_DM1 0x0008
76  #define HCI_PACKET_TYPE_DH1 0x0010
77  #define HCI_PACKET_TYPE_NO_2_DH3 0x0100
78  #define HCI_PACKET_TYPE_NO_3_DH3 0x0200
79  #define HCI_PACKET_TYPE_DM3 0x0400
80  #define HCI_PACKET_TYPE_DH3 0x0800
81  #define HCI_PACKET_TYPE_NO_2_DH5 0x1000
82  #define HCI_PACKET_TYPE_NO_3_HD5 0x2000
83  #define HCI_PACKET_TYPE_DM5 0x4000
84  #define HCI_PACKET_TYPE_DH5 0x8000
85  
86  #define HCI_PAGE_SCAN_REPETITION_MODE_R0 0x00
87  #define HCI_PAGE_SCAN_REPETITION_MODE_R1 0x01
88  #define HCI_PAGE_SCAN_REPETITION_MODE_R2 0x02
89  
90  #define HCI_NOT_ALLOW_ROLE_SWITCH 0x00
91  #define HCI_ALLOW_ROLE_SWITCH 0x01
92  
93  typedef struct {
94      HciBdAddr bdAddr;
95      uint16_t packetType;
96      uint8_t pageScanRepetitionMode;
97      uint8_t reserved;
98      uint16_t clockOffset;
99      uint8_t allowRoleSwitch;
100  } HciCreateConnectionParam;
101  
102  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
103  // 7.1.6 Disconnect Command
104  #define HCI_DISCONNECT MAKE_OPCODE(0x0006, HCI_COMMAND_OGF_LINK_CONTROL)
105  
106  typedef struct {
107      uint16_t connectionHandle;
108      uint8_t reason;
109  } HciDisconnectParam;
110  
111  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
112  // 7.1.7 Create Connection Cancel Command
113  #define HCI_CREATE_CONNECTION_CANCEL MAKE_OPCODE(0x0008, HCI_COMMAND_OGF_LINK_CONTROL)
114  
115  typedef struct {
116      HciBdAddr bdAddr;
117  } HciCreateConnectionCancelParam;
118  
119  typedef struct {
120      uint8_t status;
121      HciBdAddr bdAddr;
122  } HciCreateConnectionCancelReturnParam;
123  
124  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
125  // 7.1.8 Accept Connection Request Command
126  #define HCI_ACCEPT_CONNECTION_REQUEST MAKE_OPCODE(0x0009, HCI_COMMAND_OGF_LINK_CONTROL)
127  
128  #define HCI_ROLE_MASTER 0x00
129  #define HCI_ROLE_SLAVE 0x01
130  
131  typedef struct {
132      HciBdAddr bdAddr;
133      uint8_t role;
134  } HciAcceptConnectionReqestParam;
135  
136  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
137  // 7.1.9 Reject Connection Request Command
138  #define HCI_REJECT_CONNECTION_REQUEST MAKE_OPCODE(0x000A, HCI_COMMAND_OGF_LINK_CONTROL)
139  
140  typedef struct {
141      HciBdAddr bdAddr;
142      uint8_t reason;
143  } HciRejectConnectionRequestParam;
144  
145  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
146  // 7.1.10 Link Key Request Reply Command
147  #define HCI_LINK_KEY_REQUEST_REPLY MAKE_OPCODE(0x000B, HCI_COMMAND_OGF_LINK_CONTROL)
148  
149  typedef struct {
150      HciBdAddr bdAddr;
151      uint8_t linkKey[16];
152  } HciLinkKeyRequestReplyParam;
153  
154  typedef struct {
155      uint8_t status;
156      HciBdAddr bdAddr;
157  } HciLinkKeyRequestReplyReturnParam;
158  
159  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
160  // 7.1.11 Link Key Request Negative Reply Command
161  #define HCI_LINK_KEY_REQUEST_NEGATIVE_REPLY MAKE_OPCODE(0x000C, HCI_COMMAND_OGF_LINK_CONTROL)
162  
163  typedef struct {
164      HciBdAddr bdAddr;
165  } HciLinkKeyRequestNegativeReplyParam;
166  
167  typedef struct {
168      uint8_t status;
169      HciBdAddr bdAddr;
170  } HciLinkKeyRequestNegativeReplyReturnParam;
171  
172  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
173  // 7.1.12 PIN Code Request Reply Command
174  #define HCI_PIN_CODE_REQUEST_REPLY MAKE_OPCODE(0x000D, HCI_COMMAND_OGF_LINK_CONTROL)
175  
176  typedef struct {
177      HciBdAddr bdAddr;
178      uint8_t pinCodeLength;
179      uint8_t pinCode[16];
180  } HciPinCodeRequestReplyParam;
181  
182  typedef struct {
183      uint8_t status;
184      HciBdAddr bdAddr;
185  } HciPinCodeRequestReplyReturnParam;
186  
187  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
188  // 7.1.13 PIN Code Request Negative Reply Command
189  #define HCI_PIN_CODE_REQUEST_NEGATIVE_REPLY MAKE_OPCODE(0x000E, HCI_COMMAND_OGF_LINK_CONTROL)
190  
191  typedef struct {
192      HciBdAddr bdAddr;
193  } HciPinCodeRequestNegativeReplyParam;
194  
195  typedef struct {
196      uint8_t status;
197      HciBdAddr bdAddr;
198  } HciPinCodeRequestNegativeReplyReturnParam;
199  
200  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
201  // 7.1.14 Change Connection Packet Type Command
202  #define HCI_CHANGE_CONNECTION_PACKET_TYPE MAKE_OPCODE(0x000F, HCI_COMMAND_OGF_LINK_CONTROL)
203  
204  typedef struct {
205      uint16_t connectionHandle;
206      uint16_t packetType;
207  } HciChangeConnectionPacketTypeParam;
208  
209  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
210  // 7.1.15 Authentication Requested Command
211  #define HCI_AUTHENTICATION_REQUESTED MAKE_OPCODE(0x0011, HCI_COMMAND_OGF_LINK_CONTROL)
212  
213  typedef struct {
214      uint16_t connectionHandle;
215  } HciAuthenticationRequestedParam;
216  
217  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
218  // 7.1.16 Set Connection Encryption Command
219  #define HCI_SET_CONNECTION_ENCRYPTION MAKE_OPCODE(0x0013, HCI_COMMAND_OGF_LINK_CONTROL)
220  
221  #define LINK_LEVEL_ENCRYPTION_OFF 0x00
222  #define LINK_LEVEL_ENCRYPTION_ON 0x01
223  
224  typedef struct {
225      uint16_t connectionHandle;
226      uint8_t encryptionEnable;
227  } HciSetConnectionEncryptionParam;
228  
229  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
230  // 7.1.17 Change Connection Link Key Command
231  #define HCI_CHANGE_CONNECTION_LINK_KEY MAKE_OPCODE(0x0015, HCI_COMMAND_OGF_LINK_CONTROL)
232  
233  typedef struct {
234      uint16_t connectionHandle;
235  } HciChangeConnectionLinkKeyParam;
236  
237  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
238  // 7.1.18 Master Link Key Command
239  #define HCI_MASTER_LINK_KEY MAKE_OPCODE(0x0017, HCI_COMMAND_OGF_LINK_CONTROL)
240  
241  typedef struct {
242      uint8_t keyFlag;
243  } HciMasterLinkKeyParam;
244  
245  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
246  // 7.1.19 Remote Name Request Command
247  #define HCI_REMOTE_NAME_REQUEST MAKE_OPCODE(0x0019, HCI_COMMAND_OGF_LINK_CONTROL)
248  
249  typedef struct {
250      HciBdAddr addr;
251      uint8_t pageScanRepetMode;
252      uint8_t reserved;
253      uint16_t clockOffset;
254  } HciRemoteNameRequestParam;
255  
256  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
257  // 7.1.20 Remote Name Request Cancel Command
258  #define HCI_REMOTE_NAME_REQUEST_CANCEL MAKE_OPCODE(0x001A, HCI_COMMAND_OGF_LINK_CONTROL)
259  
260  typedef struct {
261      HciBdAddr addr;
262  } HciRemoteNameRequestCancelParam;
263  
264  typedef struct {
265      uint8_t status;
266      HciBdAddr addr;
267  } HciRemoteNameRequestCancelReturnParam;
268  
269  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
270  // 7.1.21 Read Remote Supported Features Command
271  #define HCI_READ_REMOTE_SUPPORTED_FEATURES MAKE_OPCODE(0x001B, HCI_COMMAND_OGF_LINK_CONTROL)
272  
273  typedef struct {
274      uint16_t connectionHandle;
275  } HciReadRemoteSupportedFeaturesParam;
276  
277  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
278  // 7.1.22 Read Remote Extended Features Command
279  #define HCI_READ_REMOTE_EXTENDED_FEATURES MAKE_OPCODE(0x001C, HCI_COMMAND_OGF_LINK_CONTROL)
280  
281  typedef struct {
282      uint16_t connectionHandle;
283      uint8_t pageNumber;
284  } HciReadRemoteExtendedFeaturesParam;
285  
286  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
287  // 7.1.23 Read Remote Version Information Command
288  #define HCI_READ_REMOTE_VERSION_INFORMATION MAKE_OPCODE(0x001D, HCI_COMMAND_OGF_LINK_CONTROL)
289  
290  typedef struct {
291      uint16_t connectionHandle;
292  } HciReadRemoteVersionInformationParam;
293  
294  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
295  // 7.1.24 Read Clock Offset Command
296  #define HCI_READ_CLOCK_OFFSET MAKE_OPCODE(0x001F, HCI_COMMAND_OGF_LINK_CONTROL)
297  
298  typedef struct {
299      uint16_t connectionHandle;
300  } HciReadClockOffsetParam;
301  
302  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
303  // 7.1.25 Read LMP Handle Command
304  #define HCI_READ_LMP_HANDLE MAKE_OPCODE(0x0020, HCI_COMMAND_OGF_LINK_CONTROL)
305  
306  typedef struct {
307      uint16_t connectionHandle;
308  } HciReadLmpHandleParam;
309  
310  typedef struct {
311      uint8_t status;
312      uint16_t connectionHandle;
313      uint8_t lmpHandle;
314      uint32_t reserved;
315  } HciReadLmpHandleReturnParam;
316  
317  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
318  // 7.1.26 Setup Synchronous Connection Command
319  #define HCI_SETUP_SYNCHRONOUS_CONNECTION MAKE_OPCODE(0x0028, HCI_COMMAND_OGF_LINK_CONTROL)
320  
321  typedef struct {
322      uint16_t connectionHandle;
323      uint32_t transmitBandwidth;
324      uint32_t receiveBandwidth;
325      uint16_t maxLatency;
326      uint16_t voiceSetting;
327      uint8_t retransmissionEffort;
328      uint16_t packetType;
329  } HciSetupSynchronousConnectionParam;
330  
331  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
332  // 7.1.27 Accept Synchronous Connection Request Command
333  #define HCI_ACCEPT_SYNCHRONOUS_CONNECTION_REQUEST MAKE_OPCODE(0x0029, HCI_COMMAND_OGF_LINK_CONTROL)
334  
335  typedef struct {
336      HciBdAddr addr;
337      uint32_t transmitBandwidth;
338      uint32_t receiveBandwidth;
339      uint16_t maxLatency;
340      uint16_t voiceSetting;
341      uint8_t retransmissionEffort;
342      uint16_t packetType;
343  } HciAcceptSynchronousConnectionRequestParam;
344  
345  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
346  // 7.1.28 Reject Synchronous Connection Request Command
347  #define HCI_REJECT_SYNCHRONOUS_CONNECTION_REQUEST MAKE_OPCODE(0x002A, HCI_COMMAND_OGF_LINK_CONTROL)
348  
349  typedef struct {
350      HciBdAddr bdAddr;
351      uint8_t reason;
352  } HciRejectSynchronousConnectionRequestParam;
353  
354  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
355  // 7.1.29 IO Capability Request Reply Command
356  #define HCI_IO_CAPABILITY_REQUEST_REPLY MAKE_OPCODE(0x002B, HCI_COMMAND_OGF_LINK_CONTROL)
357  
358  #define IO_CAPABILITY_DISPLAY_ONLY 0x00
359  #define IO_CAPABILITY_DISPLAY_YES_NO 0x01
360  #define IO_CAPABILITY_KEYBOARD_ONLY 0x02
361  #define IO_CAPABILITY_NO_INPUT_NO_OUTPUT 0x03
362  
363  #define OOB_DATA_NOT_PRESENT 0x00
364  #define OOB_DATA_P_192 0x01
365  #define OOB_DATA_P_256 0x02
366  #define OOB_DATA_P_192_AND_P_256 0x03
367  
368  #define AUTHENTICATION_NO_MITM_NO_BONDING 0x00
369  #define AUTHENTICATION_MITM_NO_BONDING 0x01
370  #define AUTHENTICATION_NO_MITM_DEDICATED_BONDING 0x02
371  #define AUTHENTICATION_MITM_DEDICATED_BONDING 0x03
372  #define AUTHENTICATION_NO_MITM_GENERAL_BONDING 0x04
373  #define AUTHENTICATION_MITM_GENERAL_BONDING 0x05
374  
375  typedef struct {
376      HciBdAddr bdAddr;
377      uint8_t ioCapability;
378      uint8_t oobDataPresent;
379      uint8_t authenticationRequirements;
380  } HciIOCapabilityRequestReplyParam;
381  
382  typedef struct {
383      uint8_t status;
384      HciBdAddr bdAddr;
385  } HciIOCapabilityRequestReplyReturnParam;
386  
387  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
388  // 7.1.30 User Confirmation Request Reply Command
389  #define HCI_USER_CONFIRMATION_REQUEST_REPLY MAKE_OPCODE(0x002C, HCI_COMMAND_OGF_LINK_CONTROL)
390  
391  typedef struct {
392      HciBdAddr bdAddr;
393  } HciUserConfirmationRequestReplyParam;
394  
395  typedef struct {
396      uint8_t status;
397      HciBdAddr bdAddr;
398  } HciUserConfirmationRequestReplyReturnParam;
399  
400  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
401  // 7.1.31 User Confirmation Request Negative Reply Command
402  #define HCI_USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY MAKE_OPCODE(0x002D, HCI_COMMAND_OGF_LINK_CONTROL)
403  
404  typedef struct {
405      HciBdAddr bdAddr;
406  } HciUserConfirmationRequestNegativeReplyParam;
407  
408  typedef struct {
409      uint8_t status;
410      HciBdAddr bdAddr;
411  } HciUserConfirmationRequestNegativeReplyReturnParam;
412  
413  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
414  // 7.1.32 User Passkey Request Reply Command
415  #define HCI_USER_PASSKEY_REQUEST_REPLY MAKE_OPCODE(0x002E, HCI_COMMAND_OGF_LINK_CONTROL)
416  
417  typedef struct {
418      HciBdAddr bdAddr;
419      uint32_t numericValue;
420  } HciUserPasskeyRequestReplyParam;
421  
422  typedef struct {
423      uint8_t status;
424      HciBdAddr bdAddr;
425  } HciUserPasskeyRequestReplyReturnParam;
426  
427  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
428  // 7.1.33 User Passkey Request Negative Reply Command
429  #define HCI_USER_PASSKEY_REQUEST_NEGATIVE_REPLY MAKE_OPCODE(0x002F, HCI_COMMAND_OGF_LINK_CONTROL)
430  
431  typedef struct {
432      HciBdAddr bdAddr;
433  } HciUserPasskeyRequestNegativeReplyParam;
434  
435  typedef struct {
436      uint8_t status;
437      HciBdAddr bdAddr;
438  } HciUserPasskeyRequestNegativeReplyReturnParam;
439  
440  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
441  // 7.1.34 Remote OOB Data Request Reply Command
442  #define HCI_REMOTE_OOB_DATA_REQUEST_REPLY MAKE_OPCODE(0x0030, HCI_COMMAND_OGF_LINK_CONTROL)
443  
444  typedef struct {
445      HciBdAddr bdAddr;
446      uint8_t C[16];
447      uint8_t r[16];
448  } HciRemoteOobDataRequestReplyParam;
449  
450  typedef struct {
451      uint8_t status;
452      HciBdAddr bdAddr;
453  } HciRemoteOobDataRequestReplyReturnParam;
454  
455  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
456  // 7.1.35 Remote OOB Data Request Negative Reply Command
457  #define HCI_REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY MAKE_OPCODE(0x0033, HCI_COMMAND_OGF_LINK_CONTROL)
458  
459  typedef struct {
460      HciBdAddr bdAddr;
461  } HciRemoteOobDataRequestNegativeReplyParam;
462  
463  typedef struct {
464      uint8_t status;
465      HciBdAddr bdAddr;
466  } HciRemoteOobDataRequestNegativeReplyReturnParam;
467  
468  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
469  // 7.1.36 IO Capability Request Negative Reply Command
470  #define HCI_IO_CAPABILITY_REQUEST_NEGATIVE_REPLY MAKE_OPCODE(0x0034, HCI_COMMAND_OGF_LINK_CONTROL)
471  
472  typedef struct {
473      HciBdAddr bdAddr;
474      uint8_t reason;
475  } HciIoCapabilityRequestNegativeReplyParam;
476  
477  typedef struct {
478      uint8_t status;
479      HciBdAddr bdAddr;
480  } HciIoCapabilityRequestNegativeReplyReturnParam;
481  
482  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
483  // 7.1.37 Create Physical Link Command
484  #define HCI_CREATE_PHYSICAL_LINK MAKE_OPCODE(0x0035, HCI_COMMAND_OGF_LINK_CONTROL)
485  
486  typedef struct {
487      uint8_t physicalLinkHandle;
488      uint8_t dedicatedAMPKeyLength;
489      uint8_t dedicatedAMPKeyType;
490      uint8_t *dedicatedAMPKey;
491  } HciCreatePhysicalLinkParam;
492  
493  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
494  // 7.1.38 Accept Physical Link Command
495  #define HCI_ACCEPT_PHYSICAL_LINK MAKE_OPCODE(0x0036, HCI_COMMAND_OGF_LINK_CONTROL)
496  
497  typedef struct {
498      uint8_t physicalLinkHandle;
499      uint8_t dedicatedAmpKeyLength;
500      uint8_t dedicatedAmpKeyType;
501      uint8_t *dedicatedAmpKey;
502  } HciAcceptPhysicalLinkParam;
503  
504  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
505  // 7.1.39 Disconnect Physical Link Command
506  #define HCI_DISCONNECT_PHYSICAL_LINK MAKE_OPCODE(0x0037, HCI_COMMAND_OGF_LINK_CONTROL)
507  
508  typedef struct {
509      uint8_t physicalLinkHandle;
510      uint8_t reason;
511  } HciDisconnectPhysicalLinkParam;
512  
513  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
514  // 7.1.40 Create Logical Link Command
515  #define HCI_CREATE_LOGICAL_LINK MAKE_OPCODE(0x0038, HCI_COMMAND_OGF_LINK_CONTROL)
516  
517  typedef struct {
518      uint8_t physicalLinkHandle;
519      uint8_t txFlowSpec[16];
520      uint8_t rxFlowSpec[16];
521  } HciCreateLogicalLinkParam;
522  
523  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
524  // 7.1.41 Accept Logical Link Command
525  #define HCI_ACCEPT_LOGICAL_LINK MAKE_OPCODE(0x0039, HCI_COMMAND_OGF_LINK_CONTROL)
526  
527  typedef struct {
528      uint8_t physicalLinkHandle;
529      uint8_t txFlowSpec[16];
530      uint8_t rxFlowSpec[16];
531  } HciAcceptLogicalLinkParam;
532  
533  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
534  // 7.1.42 Disconnect Logical Link Command
535  #define HCI_DISCONNECT_LOGICAL_LINK MAKE_OPCODE(0x003A, HCI_COMMAND_OGF_LINK_CONTROL)
536  
537  typedef struct {
538      uint16_t logicalLinkHandle;
539  } HciDisconnectLogicalLinkParam;
540  
541  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
542  // 7.1.43 Logical Link Cancel Command
543  #define HCI_LOGICAL_LINK_CANCEL MAKE_OPCODE(0x003B, HCI_COMMAND_OGF_LINK_CONTROL)
544  
545  typedef struct {
546      uint8_t physicalLinkHandle;
547      uint8_t txFlowSpecID;
548  } HciLogicalLinkCancelParam;
549  
550  typedef struct {
551      uint8_t status;
552      uint8_t physicalLinkHandle;
553      uint8_t txFlowSpecID;
554  } HciLogicalLinkCancelReturnParam;
555  
556  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
557  // 7.1.44 Flow Spec Modify Command
558  #define HCI_FLOW_SPEC_MODIFY MAKE_OPCODE(0x003C, HCI_COMMAND_OGF_LINK_CONTROL)
559  
560  typedef struct {
561      uint16_t handle;
562      uint8_t txFlowSpec[16];
563      uint8_t rxFlowSpec[16];
564  } HciFlowSpecModifyParam;
565  
566  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
567  // 7.1.45 Enhanced Setup Synchronous Connection Command
568  #define HCI_ENHANCED_SETUP_SYNCHRONOUS_CONNECTION MAKE_OPCODE(0x003D, HCI_COMMAND_OGF_LINK_CONTROL)
569  
570  typedef struct {
571      uint8_t codingFormat;
572      uint16_t companyID;
573      uint16_t vendorSpecificCodecID;
574  } HciCodeingFormat;
575  
576  #define HCI_CODING_FORMAT_U_LAW_LOG 0x00
577  #define HCI_CODING_FORMAT_A_LAW_LOG 0x01
578  #define HCI_CODING_FORMAT_CVSD 0x02
579  #define HCI_CODING_FORMAT_TRANSPNT 0x03
580  #define HCI_CODING_FORMAT_LINEAR_PCM 0x04
581  #define HCI_CODING_FORMAT_MSBC 0x05
582  #define HCI_CODING_FORMAT_VENDOR_SPECIFIC 0xFF
583  
584  #define HCI_PCM_DATA_FORMAT_NA 0x00
585  #define HCI_PCM_DATA_FORMAT_1_COMPLEMENT 0x01
586  #define HCI_PCM_DATA_FORMAT_2_COMPLEMENT 0x02
587  #define HCI_PCM_DATA_FORMAT_SIGN_MAGNITUDE 0x03
588  #define HCI_PCM_DATA_FORMAT_UNSIGNED 0x04
589  
590  typedef struct {
591      uint16_t connectionHandle;
592      uint32_t transmitBandwidth;
593      uint32_t receiveBandwidth;
594      HciCodeingFormat transmitCodingFormat;
595      HciCodeingFormat receiveCodingFormat;
596      uint16_t transmitCodecFrameSize;
597      uint16_t receiveCodecFrameSize;
598      uint32_t inputBandwidth;
599      uint32_t outputBandwidth;
600      HciCodeingFormat inputCodingFormat;
601      HciCodeingFormat outputCodingFormat;
602      uint16_t inputCodedDataSize;
603      uint16_t outputCodedDataSize;
604      uint8_t inputPCMDataFormat;
605      uint8_t outputPCMDataFormat;
606      uint8_t inputPCMSamplePayloadMSBPosition;
607      uint8_t outputPCMSamplePaylandMSBPosition;
608      uint8_t inputDataPath;
609      uint8_t outputDataPath;
610      uint8_t inputTransportUnitSize;
611      uint8_t outputTransportUnitSize;
612      uint16_t maxLatency;
613      uint16_t packetType;
614      uint8_t retransmissionEffort;
615  } HciEnhancedSetupSynchronousConnectionParam;
616  
617  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
618  // 7.1.46 Enhanced Accept Synchronous Connection Request Command
619  #define HCI_ENHANCED_ACCEPT_SYNCHRONOUS_CONNECTION_REQUEST MAKE_OPCODE(0x003E, HCI_COMMAND_OGF_LINK_CONTROL)
620  
621  typedef struct {
622      HciBdAddr bdAddr;
623      uint32_t transmitBandwidth;
624      uint32_t receiveBandwidth;
625      HciCodeingFormat transmitCodingFormat;
626      HciCodeingFormat receiveCodingFormat;
627      uint16_t transmitCodecFrameSize;
628      uint16_t receiveCodecFrameSize;
629      uint32_t inputBandwidth;
630      uint32_t outputBandwidth;
631      HciCodeingFormat inputCodingFormat;
632      HciCodeingFormat outputCodingFormat;
633      uint16_t inputCodedDataSize;
634      uint16_t outputCodedDataSize;
635      uint8_t inputPCMDataFormat;
636      uint8_t outputPCMDataFormat;
637      uint8_t inputPCMSamplePayloadMSBPosition;
638      uint8_t outputPCMSamplePaylandMSBPosition;
639      uint8_t inputDataPath;
640      uint8_t outputDataPath;
641      uint8_t inputTransportUnitSize;
642      uint8_t outputTransportUnitSize;
643      uint16_t maxLatency;
644      uint16_t packetType;
645      uint8_t retransmissionEffort;
646  } HciEnhancedAcceptSynchronousConnectionRequestParam;
647  
648  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
649  // 7.1.47 Truncated Page Command
650  #define HCI_TRUNCATED_PAGE MAKE_OPCODE(0x003F, HCI_COMMAND_OGF_LINK_CONTROL)
651  
652  typedef struct {
653      HciBdAddr bdAddr;
654      uint8_t pageScanRepetitionMode;
655      uint16_t clockOffset;
656  } HciTruncatedPageParam;
657  
658  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
659  // 7.1.48 Truncated Page Cancel Command
660  #define HCI_TRUNCATED_PAGE_CANCEL MAKE_OPCODE(0x0040, HCI_COMMAND_OGF_LINK_CONTROL)
661  
662  typedef struct {
663      HciBdAddr bdAddr;
664  } HciTruncatedPageCancelParam;
665  
666  typedef struct {
667      uint8_t status;
668      HciBdAddr bdAddr;
669  } HciTruncatedPageCancelReturnParam;
670  
671  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
672  // 7.1.49 Set Connectionless Slave Broadcast Command
673  #define HCI_SET_CONNECTIONLESS_SLAVE_BROADCAST MAKE_OPCODE(0x0041, HCI_COMMAND_OGF_LINK_CONTROL)
674  
675  typedef struct {
676      uint8_t enable;
677      uint8_t ltAddr;
678      uint8_t lpoAllowed;
679      uint16_t packetType;
680      uint16_t intervalMin;
681      uint16_t intervalMax;
682      uint16_t csbSupervisionTo;
683  } HciSetConnectionlessSlaveBroadcastParam;
684  
685  typedef struct {
686      uint8_t status;
687      uint8_t ltAddr;
688      uint16_t interval;
689  } HciSetConnectionlessSlaveBroadcastReturnParam;
690  
691  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
692  // 7.1.50 Set Connectionless Slave Broadcast Receive Command
693  #define HCI_SET_CONNECTIONLESS_SLAVE_BROADCAST_RECEIVE MAKE_OPCODE(0x0042, HCI_COMMAND_OGF_LINK_CONTROL)
694  
695  typedef struct {
696      uint8_t enable;
697      HciBdAddr bdAddr;
698      uint8_t ltAddr;
699      uint16_t interval;
700      uint32_t clockOffset;
701      uint32_t nextConnectionlessSlaveBroadcastClock;
702      uint16_t csbSupervisionTo;
703      uint8_t remoteTimingAccuracy;
704      uint8_t skip;
705      uint16_t packetType;
706      uint8_t afhChannelMap[10];
707  } HciSetConnectionlessSlaveBroadcastReceiveParam;
708  
709  typedef struct {
710      uint8_t status;
711      HciBdAddr bdAddr;
712      uint8_t ltAddr;
713  } HciSetConnectionlessSlaveBroadcastReceiveReturnParam;
714  
715  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
716  // 7.1.51 Start Synchronization Train Command
717  #define HCI_START_SYNCHRONIZATION_TRAIN MAKE_OPCODE(0x0043, HCI_COMMAND_OGF_LINK_CONTROL)
718  
719  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
720  // 7.1.52 Receive Synchronization Train Command
721  #define HCI_RECEIVE_SYNCHRONIZATION_TRAIN MAKE_OPCODE(0x0044, HCI_COMMAND_OGF_LINK_CONTROL)
722  
723  typedef struct {
724      HciBdAddr bdAddr;
725      uint16_t synchronizationscanTO;
726      uint16_t syncScanWindow;
727      uint16_t syncScanInterval;
728  } HciReceiveSynchronizationTrainParam;
729  
730  // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
731  // 7.1.53 Remote OOB Extended Data Request Reply Command
732  #define HCI_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY MAKE_OPCODE(0x0045, HCI_COMMAND_OGF_LINK_CONTROL)
733  
734  typedef struct {
735      HciBdAddr bdAddr;
736      uint8_t c192[16];
737      uint8_t r192[16];
738      uint8_t c256[16];
739      uint8_t r256[16];
740  } HciRemoteOobExtendedDataRequestReplyParam;
741  
742  typedef struct {
743      uint8_t status;
744      HciBdAddr bdAddr;
745  } HciRemoteOobExtendedDataRequestReplyReturnParam;
746  
747  #pragma pack(0)
748  
749  #ifdef __cplusplus
750  }
751  #endif
752  
753  #endif