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_POLICY_CMD_H 17 #define HCI_DEF_LINK_POLICY_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.2 LINK POLICY COMMANDS 31 #define HCI_COMMAND_OGF_LINK_POLICY 0x02 32 33 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 34 // 7.2.1 Hold Mode Command 35 #define HCI_HOLD_MODE MAKE_OPCODE(0x0001, HCI_COMMAND_OGF_LINK_POLICY) 36 37 typedef struct { 38 uint16_t connectionHandle; 39 uint16_t holdModeMaxInterval; 40 uint16_t holdModeMinInterval; 41 } HciHoldModeParam; 42 43 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 44 // 7.2.2 Sniff Mode Command 45 #define HCI_SNIFF_MODE MAKE_OPCODE(0x0003, HCI_COMMAND_OGF_LINK_POLICY) 46 47 typedef struct { 48 uint16_t connectionHandle; 49 uint16_t sniffMaxInterval; 50 uint16_t sniffMinInterval; 51 uint16_t sniffAttempt; 52 uint16_t sniffTimeout; 53 } HciSniffModeParam; 54 55 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 56 // 7.2.3 Exit Sniff Mode Command 57 #define HCI_EXIT_SNIFF_MODE MAKE_OPCODE(0x0004, HCI_COMMAND_OGF_LINK_POLICY) 58 59 typedef struct { 60 uint16_t connectionHandle; 61 } HciExitSniffModeParam; 62 63 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 64 // 7.2.6 QoS Setup Command 65 #define HCI_QOS_SETUP MAKE_OPCODE(0x0007, HCI_COMMAND_OGF_LINK_POLICY) 66 67 typedef struct { 68 uint16_t connectionHandle; 69 uint8_t flags; 70 uint8_t serviceType; 71 uint32_t tokenRate; 72 uint32_t peakBandwidth; 73 uint32_t latency; 74 uint32_t delayVariation; 75 } HciQosSetupParam; 76 77 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 78 // 7.2.7 Role Discovery Command 79 #define HCI_ROLE_DISCOVERY MAKE_OPCODE(0x0009, HCI_COMMAND_OGF_LINK_POLICY) 80 81 typedef struct { 82 uint16_t connectionHandle; 83 } HciRoleDiscoveryParam; 84 85 typedef struct { 86 uint8_t status; 87 uint16_t connectionHandle; 88 uint8_t currentRole; 89 } HciRoleDiscoveryReturnParam; 90 91 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 92 // 7.2.8 Switch Role Command 93 #define HCI_SWITCH_ROLE MAKE_OPCODE(0x000B, HCI_COMMAND_OGF_LINK_POLICY) 94 95 typedef struct { 96 HciBdAddr bdAddr; 97 uint8_t role; 98 } HciSwitchRoleParam; 99 100 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 101 // 7.2.9 Read Link Policy Settings Command 102 #define HCI_READ_LINK_POLICY_SETTINGS MAKE_OPCODE(0x000C, HCI_COMMAND_OGF_LINK_POLICY) 103 104 typedef struct { 105 uint16_t connectionHandle; 106 } HciReadLinkPolicySettingsParam; 107 108 typedef struct { 109 uint8_t status; 110 uint16_t connectionHandle; 111 uint16_t linkPolicySettings; 112 } HciReadLinkPolicySettingsReturnParam; 113 114 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 115 // 7.2.10 Write Link Policy Settings Command 116 #define HCI_WRITE_LINK_POLICY_SETTINGS MAKE_OPCODE(0x000D, HCI_COMMAND_OGF_LINK_POLICY) 117 118 typedef struct { 119 uint16_t connectionHandle; 120 uint16_t linkPolicySettings; 121 } HciWriteLinkPolicySettingsParam; 122 123 typedef struct { 124 uint8_t status; 125 uint16_t connectionHandle; 126 } HciWriteLinkPolicySettingsReturnParam; 127 128 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 129 // 7.2.11 Read Default Link Policy Settings Command 130 #define HCI_READ_DEFAULT_LINK_POLICY_SETTINGS MAKE_OPCODE(0x000E, HCI_COMMAND_OGF_LINK_POLICY) 131 132 typedef struct { 133 uint8_t status; 134 uint16_t defaultLinkPolicySettings; 135 } HciReadDefaultLinkPolicySettingsReturnParam; 136 137 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 138 // 7.2.12 Write Default Link Policy Settings Command 139 #define HCI_WRITE_DEFAULT_LINK_POLICY_SETTINGS MAKE_OPCODE(0x00F, HCI_COMMAND_OGF_LINK_POLICY) 140 141 #define HCI_LINK_POLICY_DISABLE_ALL 0x0000 142 #define HCI_LINK_POLICY_ENABLE_ROLE_SWITCH 0x0001 143 #define HCI_LINK_POLICY_ENABLE_HOLD_MODE 0x0002 144 #define HCI_LINK_POLICY_ENABLE_SNIFF_MODE 0x0004 145 146 typedef struct { 147 uint16_t defaultLinkPolicySettings; 148 } HciWriteDefaultLinkPolicySettingsParam; 149 150 typedef HciStatusParam HciWriteDefaultLinkPolicySettingsReturnParam; 151 152 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 153 // 7.2.13 Flow Specification Command 154 #define HCI_FLOW_SPECIFICATION MAKE_OPCODE(0x00010, HCI_COMMAND_OGF_LINK_POLICY) 155 156 typedef struct { 157 uint16_t connectionHandle; 158 uint8_t flags; 159 uint8_t flowdirection; 160 uint8_t serviceType; 161 uint32_t tokenRate; 162 uint32_t tokenBucketSize; 163 uint32_t peakBandwidth; 164 uint32_t accessLatency; 165 } HciFlowSpecificationParam; 166 167 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E 168 // 7.2.14 Sniff Subrating Command 169 #define HCI_SNIFF_SUBRATING MAKE_OPCODE(0x0011, HCI_COMMAND_OGF_LINK_POLICY) 170 171 typedef struct { 172 uint16_t connectionHandle; 173 uint16_t maximumLatency; 174 uint16_t minimumRemoteTimeout; 175 uint16_t minimumLocalTimeout; 176 } HciSniffSubratingParam; 177 178 typedef struct { 179 uint8_t status; 180 uint16_t connectionHandle; 181 } HciSniffSubratingReturnParam; 182 183 #pragma pack(0) 184 185 #ifdef __cplusplus 186 } 187 #endif 188 189 #endif