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_INFO_PARAMS_CMD_H
17 #define HCI_DEF_INFO_PARAMS_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.4 INFORMATIONAL PARAMETERS
31 #define HCI_COMMAND_OGF_INFORMATIONAL_PARAMETERS 0x04
32 
33 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
34 // 7.4.1 Read Local Version Information Command
35 #define HCI_READ_LOCAL_VERSION_INFORMATION MAKE_OPCODE(0x0001, HCI_COMMAND_OGF_INFORMATIONAL_PARAMETERS)
36 
37 typedef struct {
38     uint8_t status;
39     uint8_t hciVersion;
40     uint16_t hciRevision;
41     uint8_t lmpVersion;
42     uint16_t manufacturerName;
43     uint16_t lmpSubversion;
44 } HciReadLocalVersionInformationReturnParam;
45 
46 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
47 // 7.4.2 Read Local Supported Commands Command
48 #define HCI_READ_LOCAL_SUPPORTED_COMMANDS MAKE_OPCODE(0x0002, HCI_COMMAND_OGF_INFORMATIONAL_PARAMETERS)
49 
50 typedef struct {
51     uint8_t status;
52     uint8_t supportedCommands[64];
53 } HciReadLocalSupportedCommandsReturnParam;
54 
55 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
56 // 7.4.3 Read Local Supported Features Command
57 #define HCI_READ_LOCAL_SUPPORTED_FEATURES MAKE_OPCODE(0x0003, HCI_COMMAND_OGF_INFORMATIONAL_PARAMETERS)
58 
59 typedef struct {
60     uint8_t status;
61     HciLmpFeatures lmpFeatures;
62 } HciReadLocalSupportedFeaturesReturnParam;
63 
64 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
65 // 7.4.4 Read Local Extended Features Command
66 #define HCI_READ_LOCAL_EXTENDED_FEATURES MAKE_OPCODE(0x0004, HCI_COMMAND_OGF_INFORMATIONAL_PARAMETERS)
67 
68 typedef struct {
69     uint8_t pageNumber;
70 } HciReadLocalExtendedFeaturesParam;
71 
72 typedef struct {
73     uint8_t status;
74     uint8_t pageNumber;
75     uint8_t maximunPageNumber;
76     uint8_t extendedLMPFeatures[LMP_FEATURES_SIZE];
77 } HciReadLocalExtendedFeaturesReturnParam;
78 
79 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
80 // 7.4.5 Read Buffer Size Command
81 #define HCI_READ_BUFFER_SIZE MAKE_OPCODE(0x0005, HCI_COMMAND_OGF_INFORMATIONAL_PARAMETERS)
82 
83 typedef struct {
84     uint8_t status;
85     uint16_t hcAclDataPacketLength;
86     uint8_t hcSynchronousDataPacketLength;
87     uint16_t hcTotalNumAclDataPackets;
88     uint16_t hcTotalNumSynchronousDataPackets;
89 } HciReadBufferSizeReturnParam;
90 
91 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
92 // 7.4.6 Read BD_ADDR Command
93 #define HCI_READ_BD_ADDR MAKE_OPCODE(0x0009, HCI_COMMAND_OGF_INFORMATIONAL_PARAMETERS)
94 
95 typedef struct {
96     uint8_t status;
97     HciBdAddr bdAddr;
98 } HciReadBdAddrReturnParam;
99 
100 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
101 // 7.4.7 Read Data Block Size Command
102 #define HCI_READ_DATA_BLOCK_SIZE MAKE_OPCODE(0x000A, HCI_COMMAND_OGF_INFORMATIONAL_PARAMETERS)
103 
104 typedef struct {
105     uint8_t status;
106     uint16_t maxAclDataPacketLength;
107     uint16_t dataBlockLength;
108     uint16_t totalNumDataBlocks;
109 } HciReadDataBlockSizeReturnParam;
110 
111 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E
112 // 7.4.8 Read Local Supported Codecs Command
113 #define HCI_READ_LOCAL_SUPPORTED_CODECS MAKE_OPCODE(0x000B, HCI_COMMAND_OGF_INFORMATIONAL_PARAMETERS)
114 
115 typedef struct {
116     uint16_t companyID;
117     uint16_t vendorDefinedCodecID;
118 } HciVendorSpecificCodec;
119 
120 typedef struct {
121     uint8_t status;
122     uint8_t numberOfSupportedCodecs;
123     uint8_t *supportedCodecs;
124     uint8_t numberOfSupportedVendorSpecificCodecs;
125     HciVendorSpecificCodec *vendorSpecificCodecs;
126 } HciReadLocalSupportedCodecsReturnParam;
127 
128 #pragma pack(0)
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif